The free Microsoft RSAT tools come with the PowerShell “ActiveDirectory” module: plenty of cmdlets help you administer Active Directory users and computers.
One cmdlet is especially useful. Rather than trying to find AD users with Get-ADUser and complex filters, use Search-ADAccount instead. It is specialized in finding users based on common scenarios. This line, for example, finds all user accounts that have been inactive for 120 days:
Search-ADAccount -AccountInactive -TimeSpan 120 -UsersOnly
ReTweet this Tip!