My PowerShell

Windows Powershell scripts, examples, tips, docs …

Active Directory cmdlets – Search-ADAccount

Search-ADAccount
Get AD user, computer, or service accounts.

Examples:

Find all users, computers and service accounts that are disabled:

Search-ADAccount -AccountDisabled | Format-Table Name,ObjectClass -A

Find all users that are disabled:

Search-ADAccount -AccountDisabled -UsersOnly | Format-Table Name,ObjectClass -A

Find all accounts where the password has expired:

Search-ADAccount -PasswordExpired | Format-Table Name,ObjectClass -A

Find all accounts that have been inactive for the last 180 days:

Search-ADAccount -AccountInactive -TimeSpan 180.00:00:00 | Format-Table Name,ObjectClass -A

 

Tagged as:

Leave a Response