dos command to create a user account

  • Thread starter Thread starter sm
  • Start date Start date
S

sm

Hi everyone,
Does anyone knows if there is a dos command to create a
local user account? So that i can include it in a script
for multiple installation.
thanks.

regards,
sm
 
Alt 1 - using a batchfile

@Echo Off
REM Set values
Set strUserName=johan
Set strPassword=P@ssw0rd

REM Create the user account in Windows 2000
net user %strUserName% /add %strPassword%


Alt 2: using vbscript, filesystem and adsi (supports more parameters
and better error-handling)

' Set values
strComputerName = "."
strUserName = "Johan"
strFullName = "Johan Arwidmark"
strDescription = "Windows Geek"
strPassword = "P@ssw0rd"

' Create the user account in Windows 2000 or XP
Set adsComputer = GetObject("WinNT://" & strComputerName &
",Computer")
Set adsUser = adsComputer.Create("user",strUserName)
adsUser.FullName = strFullName
adsUser.Description = strDescription
adsUser.SetPassword strPassword
adsUser.SetInfo


regards
Johan Arwidmark

Windows User Group - Nordic
http://www.wug-nordic.net
 
Back
Top