The PC will not be attached to a network when this script is running. I am hoping to use this as a way to unlock local user accounts on Windows XP, on machines that are out in the field. My script now looks like this...
Set objNet = CreateObject("WScript.Network")
CompName = objNet.ComputerName
UserName = CompName
password = "forget" & Month(Date) & Day(Date)
Set UserObject = GetObject("WinNT://" & computerName)
wscript.echo isnull(userObject) & isempty(userObject)
UserObject.Filter = Array("user")
For Each oUser in UserObject
If oUser.Name = UserName Then
Set UserObj = GetObject("WinNT://127.0.0.1/"& UserName &"")
If UserObj.IsAccountLocked = -1 Then
UserObj.IsAccountLocked = 0
UserObj.SetPassword password
UserObj.Put "PasswordExpired", 1
UserObj.SetInfo
WScript.Echo "Your account has been locked out."
End If
End If
Next
I am getting a error on line 9, character 1, the source is (null). Thanks for your continued help.