I have this script that you enter the users login ID and is unlocks their account. It tells you if the account is not locked or if it was succesfully unlocked. I would like to ad a sub routine that checks to see if the name entered is valid and if not returns an error.
Here is the code, can I get some help with this?
UserName = InputBox("Enter the user's login name that you want to unlock:")
Set UserObj = GetObject("WinNT://domainnam/"& UserName &"")
If UserObj.IsAccountLocked = 0 Then
Wscript.Echo "The Account is not locked"
Else
If UserObj.IsAccountLocked = -1 then UserObj.IsAccountLocked = 0
UserObj.SetInfo
Wscript.Echo "The account was unlocked succesfully"
End If
Question
mattr2110
I have this script that you enter the users login ID and is unlocks their account. It tells you if the account is not locked or if it was succesfully unlocked. I would like to ad a sub routine that checks to see if the name entered is valid and if not returns an error.
Here is the code, can I get some help with this?
UserName = InputBox("Enter the user's login name that you want to unlock:") Set UserObj = GetObject("WinNT://domainnam/"& UserName &"") If UserObj.IsAccountLocked = 0 Then Wscript.Echo "The Account is not locked" Else If UserObj.IsAccountLocked = -1 then UserObj.IsAccountLocked = 0 UserObj.SetInfo Wscript.Echo "The account was unlocked succesfully" End IfLink to comment
Share on other sites
1 answer to this question
Recommended Posts