DOS:
NET USER DosUser UserPassword /add
VBS:
Set WshNetwork = CreateObject("WScript.Network")
strComputerName = WshNetwork.ComputerName 'getting the machine name
strUserName="VbsUser"
strPassword="UserPassword"
checkuser = 1
Set objComputer = GetObject("WinNT://" & strComputerName)
objComputer.Filter = Array("User")
For Each objUser In objComputer
If (objUser.Name = strUserName) And (checkuser = 1) Then
checkuser = 0
End If
Next
If checkuser = 1 Then
Set colaccounts = GetObject("WinNT://" & strComputerName & ",computer")
Set objUser = colaccounts.Create("user", strUserName)
objUser.SetPassword strPassword
objUser.SetInfo
End If
No comments:
Post a Comment