Jump to content

Active Directory


 Share

Recommended Posts

Does anyone know of a way to show all locked accounts and unlock them using Autoit?

There was a function called _UserCtrlAttribs() posted a while back by a strikingly good-looking flightless antarctic waterfowl. Maybe that will help?

<_<

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

This same handsome bird, having gained in knowledge, wisdom, and gotten even better looking with age, has another idea:

Global Const $wbemFlagReturnImmediately = 0x10
Global Const $wbemFlagForwardOnly = 0x20
$iFlags = $wbemFlagReturnImmediately + $wbemFlagForwardOnly
$strComputer = @ComputerName
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colUsers = $objWMIService.ExecQuery("SELECT * FROM Win32_UserAccount", "WQL", $iFlags)

; List locked out users
$sMsg = "Users:" & @CRLF
For $objUser In $colUsers
    If $objUser.Lockout <> 0 Then $sMsg &= $objUser.Name & @CRLF
Next
MsgBox(64, "Results", $sMsg)

; Clear lockouts
For $objUser In $colUsers
    If $objUser.Lockout <> 0 Then $objUser.Lockout = 0
Next

; List 'em again
$sMsg = "Users:" & @CRLF
For $objUser In $colUsers
    If $objUser.Lockout <> 0 Then $sMsg &= $objUser.Name & @CRLF
Next
MsgBox(64, "Results", $sMsg)

<_<

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...