Sign in with
Sign up | Sign in
Your question

Need Help with a Script!!!!

Last response: in Windows 2000/NT
June 18, 2011 7:51:29 AM

Hi guys

I need to Push a Script via the GP to Create a Local user in the PCs in my domain.the user has to be in the administrator group.. found a good powershell script but as to my knolage it wont work with windows XP machines..we still have like 10 odd win XP machines..

the script has to
*create a local user
*add the user to the administrator group
*set the password

PLease help a Brother out !!!

Thanks a lot in advance me m8

More about : script

June 18, 2011 1:02:27 PM

Guys i found this one Script
not sure wher i should change the username in this any help

uhh and is there any thing to improve here..thanks so much for your input

'this section creates the new username if it doesn't exist

Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
Set objComputer = GetObject("WinNT://" &strComputer)

Set colAccounts = GetObject("WinNT://" & strComputer & "")
Set objUser = colAccounts.Create("user", "username")
objUser.SetPassword "password"
objUser.Put "UserFlags", 65600 '

'add to administrators group
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group")
Set objUser = GetObject("WinNT://" & strComputer & "/username,user")

msgbox "username was created"

'this section just changes the password if the user exists
Sub QueryForUser(strUserName)
Set objlocal = GetObject("WinNT://.")
objlocal.Filter = Array("user")
For Each User In objlocal
If lcase(User.Name) = lcase(strUserName) Then

strComputer = "."
Set objUser = GetObject("WinNT://" & strComputer & "/username, user")
objUser.SetPassword "password"

msgbox User.Name & " already exists." & vbCrLf & "The password was re-set."
End If
End Sub
June 18, 2011 8:35:40 PM

This topic has been moved from the section Networking to section Windows 2000/NT by Grumpy9117