Solved

Powershell script to automate unlock user account

Posted on 2014-02-13
2
5,349 Views
Last Modified: 2014-02-15
Hello All,

I am looking for a powershell script that will let me automate and unlock of particular accounts.

For some reason they are some accounts getting locked everyday and I am thinking to implement this script as a schedule task until I resolve the issue. This task will run on one of my DC.

Any hint where to find one?
0
Comment
Question by:LuiLui77
2 Comments
 
LVL 39

Assisted Solution

by:footech
footech earned 225 total points
Comment Utility
I don't know if you would really want to implement this, but the following would unlock all locked out accounts.
Search-ADAccount -LockedOut | Unlock-ADAccount

Open in new window

The lock out events should tell you which machine an account is locked out on.  Anyway, assuming you don't want to unlock all accounts, you can filter the results from Search-ADAccount before piping it to Unlock-ADAccount.  For example:
Search-ADAccount -LockedOut | Where {$_.samaccountname -eq "jdoe"} | Unlock-ADAccount

Open in new window

0
 
LVL 4

Accepted Solution

by:
michaelalphi earned 275 total points
Comment Utility
To unlock specific user account : Unlock-QADUser DSotnikov
Also, you can check this Account unlock and management tool to troubleshoot account lockouts, as well as add functionality to Active Directory.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now