Posted September 25, 2003
: Rod Trent
: Windows NT with WSH 2.0 WMI 1.1, Windows 2000
: WSH, VBScript
AcctUnlock prompts for a username and domain name and unlocks the user account. The script will let you know if the account unlock was successful. Save as a .VBS file and run with either CScript or WScript.
Scroll down to view the script.
UserName = InputBox("Enter the user's login name that you want to unlock:")
DomainName = InputBox("Enter the domain name in which the user account exists:")
Set UserObj = GetObject("WinNT://"& DomainName &"/"& UserName &"")
If UserObj.IsAccountLocked = -1 then UserObj.IsAccountLocked = 0
If err.number = 0 Then
Wscript.Echo "The Account Unlock Failed. Check that the account is, in fact, locked-out."
Wscript.Echo "The Account Unlock was Successful"
Disclaimer: We hope that the information in these pages is valuable to you. Your use of the information contained in these pages, however, is at your sole risk. All information on these pages is provided "as -is", without any warranty, whether express or implied, of its accuracy, completeness, fitness for a particular purpose, title or non-infringement, and none of the third-party products or information mentioned in the work are authored, recommended, supported or guaranteed by me. I shall not be liable for any damages you may sustain by using this information, whether direct, indirect, special, incidental or consequential, even if it has been advised of the possibility of such damages.