Here's a quick PowerShell bit:
$username = 'username'
$dc = 'closestDC'
if ((Get-aduser -Identity $username -Properties lockedout -Server
$dc).lockedout -eq $true) {
Unlock-ADAccount -Identity $username -Server $dc
}
The $dc bit is so you can specify which domain controller to use; avoids
convergence time. :)
Would also be trivial to have it fire off an email if the account is locked
out. ;)
DAMIEN SOLODOW
Senior Systems Engineer
317.447.6033 (office)
317.447.6014 (fax)
HARRISON COLLEGE
From: [email protected] [mailto:[email protected]] On
Behalf Of David McSpadden
Sent: Monday, May 11, 2015 3:12 PM
To: [email protected]
Subject: [NTSysADM] RE: unlock an account via script
Thank you.
This is working just fine for my needs.
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of James Rankin
Sent: Monday, May 11, 2015 9:55 AM
To: [email protected]<mailto:[email protected]>
Subject: [NTSysADM] RE: unlock an account via script
I wonder if the old "net user /active:yes %username% /domain" does this? (Too
busy to test) :)
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of David McSpadden
Sent: 11 May 2015 14:49
To: [email protected]<mailto:[email protected]>
Subject: [NTSysADM] unlock an account via script
I want to schedule a powershell to check for a specific account to see if it is
locked out.
If it is unlock it.
Or I can just submit the unlock blindly at a specific time each day.
I don't care either way.
DC is server 2012 r2.
Account is an application admin with domain admin rights.
Need account to be unlocked prior to copying files to server.
Have been biten that last couple weekend because support tech's have been
locking it out and not emailing us that it needs unlocked.
Thanks
David McSpadden
Systems Administrator
Indiana Members Credit Union
P: 317.554.8190 | F: 317.554.8106
[Description: imcu email icon]<http://imcu.com/> [Description: facebook email
icon] <https://www.facebook.com/IndianaMembersCU> [Description: twitter email
icon] <https://twitter.com/IndMembersCU>
[Description: email logo]
[mcp2]
This e-mail and any files transmitted with it are property of Indiana Members
Credit Union, are confidential, and are intended solely for the use of the
individual or entity to whom this e-mail is addressed. If you are not one of
the named recipient(s) or otherwise have reason to believe that you have
received this message in error, please notify the sender and delete this
message immediately from your computer. Any other use, retention,
dissemination, forwarding, printing, or copying of this email is strictly
prohibited.
Please consider the environment before printing this email.
This e-mail and any files transmitted with it are property of Indiana Members
Credit Union, are confidential, and are intended solely for the use of the
individual or entity to whom this e-mail is addressed. If you are not one of
the named recipient(s) or otherwise have reason to believe that you have
received this message in error, please notify the sender and delete this
message immediately from your computer. Any other use, retention,
dissemination, forwarding, printing, or copying of this email is strictly
prohibited.
Please consider the environment before printing this email.