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

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1739
  • Last Modified:

Unlocking bulk AD user accounts through Script

Please help me developing a script (Powershell/ VBS/ command line) for unlocking bulk AD user accounts . Script will be fetching the list of IDs from a .txt / .xls file

Distinguished name for the OU where i am having permission is mentioned below

OU=India,DC=XYZ,DC=com
0
Gautam Chaudhary
Asked:
Gautam Chaudhary
  • 3
  • 2
1 Solution
 
VB ITSCommented:
No need for a text file, the below will simply identify accounts within an OU that are locked out and then unlock the account for you.
Import-Module ActiveDirectory
Search-ADAccount –SearchBase ‘OU=India,DC=XYZ,DC=com’ –LockedOut | Unlock-ADAccount

Open in new window

0
 
Gautam ChaudharyAuthor Commented:
It is a PS script...right but what do i do if i need to see the output for the query that what all are the accounts that has been unlocked
0
 
Joshua GrantomSenior EngineerCommented:
Add -Passthru

Import-Module ActiveDirectory
Search-ADAccount –SearchBase ‘OU=India,DC=XYZ,DC=com’ –LockedOut | Unlock-ADAccount -Passthru

Open in new window

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Gautam ChaudharyAuthor Commented:
Thanks VB ITS.... this solves half of my purpose....Please help if i have to unlock and reset password at the same time for a handful of domain IDs.
0
 
Gautam ChaudharyAuthor Commented:
Thanks Joshua Grantom.
Can you please help if i have to unlock and reset password at the same time for a handful of domain IDs provided the list of IDs will be fetched from a file kept at a location
0
 
Joshua GrantomSenior EngineerCommented:
Gautam,

Yes I can help you, please post a new question as you have selected an answer for this one already.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now