Unlock locked accounts with PowerShell (not with Quest AD cmdlets)

I am writing a GUI tool using PowerShell, which can perform most of the tasks related to AD with just a username and a button click. I did all the usual (creating / deleting users, creating / deleting security and distribution groups, resetting passwords, etc.), but they can’t find the unlocking of the “Blocked” account.

I am trying to do this without using Quest AD cmdlets as I want a more standalone solution. So I wonder if using simple PowerShell (1.0 or 2.0) in a Windows 2003 domain is possible.

Many thanks.

+5
source share
2 answers

Set the lockoutTime property of DirectoryEntry to 0.

Example:

$x = [ADSI]'LDAP://SomeDN'
$x.lockoutTime = 0
$x.CommitChanges()
$x.Close()
+6
source

Came out of the AD world for several years. I haven’t worked with PowerShell at all, but does the link below suggest what you are looking for?

http://dmitrysotnikov.wordpress.com/2007/08/14/enable-disable-unlock-user-accounts/

-1
source

All Articles