chris@busy.co.nzHi, What environment are you wanting to create a user in? Active directory or a local xp / vista machine. For me this could be one of those things to not waste your time scripting unless you're mass importing users or if it's for the username you want to use for your managed services. Typically when you want to create an individual user you need to assign groups etc. so scripting a one-off can be more effort than it's worth. Here is a script we have that creates a username on a local windows xp machine and gives it administrator priviliges. This particular script is not designed for AD servers but could point you in the right direction. ... Script Name: Example Create Username Script Script Description: IF True THEN Execute Shell Command Parameter 1 : net user /add username password Parameter 2 : 1 OS Type : 0 Execute Shell Command Parameter 1 : net localgroup "Administrators" /add username Parameter 2 : 1 OS Type : 0 ELSE ... Regards, Chris
Script Name: Create Local Administrator Account Script Description: Creates a local Administrator and sets the account and password to never expire. The account is hidden from the logon page. IF True THEN Execute Shell Command Parameter 1 : net user (username) (password) /add /Expires:never Parameter 2 : 1 OS Type : 1 Execute Shell Command Parameter 1 : net localgroup Administrators (username) /add Parameter 2 : 1 OS Type : 1 Set Registry Value Parameter 1 : HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList\(username) Parameter 2 : 0 Parameter 3 : REG_DWORD OS Type : 1 Impersonate User Parameter 1 : (username) Parameter 2 : (password) Parameter 3 : OS Type : 1 Execute Shell Command Parameter 1 : wmic useraccount where name="(username)" set passwordexpires=false Parameter 2 : 0 OS Type : 1 Write Script Log Entry Parameter 1 : User Account "(username)" has been created and hidden from the logon page. OS Type : 1 ELSE