Tuesday, April 17, 2007

AccountLockout.vbs

Const UF_LOCKOUT = &H0010

Dim DomainName
Dim UserName
Dim Answer

DomainName = InputBox("Enter the name of the Domain?")
UserName = InputBox("Enter the User Name?")

set objUser = GetObject("WinNT://" & DomainName & "/" & UserName & ",User")

===> cUserFlags = objUser.Get("UserFlags")


If(cUserFlags And UF_LOCKOUT) Then
WScript.Echo UserName & "'s account is locked!"
Answer = InputBox("Would you like to unlock this account? (Y/N)")
If Answer ="Y" Then

===> objUser.Put "UserFlags" , cUserFlags Xor UF_LOCKOUT

objUser.SetInfo
WScript.Echo UserName & "'s account is unlocked."
Else
WScript.Echo UserName & "'s account will remian locked."
End If
Else
WScript.Echo UserName & "'s account is ok!"
End If

No comments: