Summary: Use Windows PowerShell to get a report of inactive Active Directory accounts.
How can I use Windows PowerShell to get a report of inactive Active Directory accounts?
The 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