Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Powershell script to automate unlock user account

Posted on 2014-02-13
2
Medium Priority
?
7,409 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 41

Assisted Solution

by:footech
footech earned 900 total points
ID: 39858167
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 1100 total points
ID: 39858777
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

Ready for your healthcare security check-up?

In the past few years, healthcare organizations have become a prime target for advanced attacks. Does your organization have what it needs to defend itself? Schedule your healthcare security check-up today and download our free Healthcare Security Resource Kit today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
Transferring FSMO roles is done when an admin wants to split roles between certain Domain Controllers or the Domain Controller holding the Roles has been forcefully demoted using dcpromo / forceremoval
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

885 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