November 26th, 2014

PowerTip: Use PowerShell to Get Inactive Active Directory Accounts

Doctor Scripto
Scripter

Summary: Use Windows PowerShell to get a report of inactive Active Directory accounts.

Hey, Scripting Guy! QuestionHow can I use Windows PowerShell to get a report of inactive Active Directory accounts?

Hey, Scripting Guy! AnswerThe Search-ADAccount cmdlet has a number of parameters and switches to help identify stale accounts:

      • Search-ADAccount -AccountInactive
      • Search-ADAccount -AccountDisabled
      • Search-ADAccount -AccountExpired

You can also use the -UsersOnly or -ComputersOnly switch to narrow the results:

      • Search-ADAccount -AccountInactive -UsersOnly
      • Search-ADAccount -AccountInactive –ComputersOnly

 

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.