How to find disabled/inactive accounts in Active Directory using powershell


Log in to your active directory server and start the active directory module for powershell then run the following command to get as list of users.

Replace DC with correct name

Disabled Accounts

Search-ADAccount -AccountDisabled -SearchBase “DC=YOURDCNAME,DC=int” | FT Name,LastLogonDate,ObjectClass –A

Inactive Accounts: (No logins recorded since some day)(Corrent Datetime)

Search-ADAccount -AccountInactive -Datetime 01/10/2014 -SearchBase “DC=redtech,DC=int” | FT Name,LastLogonDate,ObjectClass –A