• 0

Help with script that unlocks user account


Question

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

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.