wajhiuddin
asked on
VB Script to unlock locla admn account
Is there a way to programmatically unlock the Admin account if it is locked?
Is there a way to configure things so that Admin will not lock? Is there a way to programmatically configure it this way?
Thanks
Wajhi
Is there a way to configure things so that Admin will not lock? Is there a way to programmatically configure it this way?
Thanks
Wajhi
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This should use the local computer account.
Set objNetwork = CreateObject("Wscript.Network")
strLocalComputer = objNetwork.ComputerName
strComputer = strLocalComputer
Set UserObj = GetObject("WinNT://" & strcomputer & "/" & "Administrator")
UserObj.IsAccountLocked = 0
UserObj.SetInfo
wscript.echo
ASKER
Great, Thanks Any way we can add some so it will ask a computer name??
We have several computers and user may screw up the script by adding a computer name??
Also can we have setup account so it will never unlock
Thanks
Wajhi
We have several computers and user may screw up the script by adding a computer name??
Also can we have setup account so it will never unlock
Thanks
Wajhi
script will ask for computer name
' ------ SCRIPT CONFIGURATION ------
strUsername = "user name"
strComputer = inputbox("enter Computer Name")
' ------ END CONFIGURATION ---------
set objUser = GetObject("WinNT://" & strComputer & "/" & strUsername)
if objUser.IsAccountLocked = True Then
objUser.IsAccountLocked = False
objUser.SetInfo
WScript.Echo "Account unlocked"
Else
WScript.Echo "Account not locked"
end If
ASKER
Thanks This works . If I can get the script to get account never locks this will be great
http://techtasks.com/code/viewbookcode/380