setting password for user using useradd?

hi all
i am writing a script to create user and group from the input given to script
for eg. script needs to values

  1. mode - 1 or 2
  2. id - if mode is 1 then id should be 2 char like x1 / v1 / v2
    if mode is 2 then id should be 1 char like x / v / e
    from these to values group is generated as : abcxr / abcvr
    and user name as : abconlx1 / abconlv2 / abconle

i have written a script that will run for sun / hp / aix but the only problem is that setting a password for the user now i am asking user to change password once the user is created with passwd <user-name> command.

is there any way that i can set default password ??

On newer versions of AIX (I believe 4.3 and up), you should be able to use the chpasswd command. On HP systems (at least 10.20 & up), you should be able to use

/usr/sam/lbin/usermod.sam -p <passwordhash>

. If you don't want the new password to expire, put a comma after the password hash. This is related to how HP-UX stores the password aging information.