Finding Users Whose Accounts Are About to Expire

Applies To: Windows Server 2008 R2

This topic explains how to use the Active Directory module for Windows PowerShell to find users whose passwords are about to expire.

Example 1

The following example demonstrates how to find all the users whose accounts are about to expire in the next 90 days:

Search-ADAccount -AccountExpiring -TimeSpan 90.00:00:00 | where {$_.ObjectClass -eq 'user'} | FT Name,ObjectClass –A

Example 2

The following example demonstrates how to find all the users whose accounts will expire on the date 10/15/2009:

Search-ADAccount -PasswordExpiring -DateTime 10/15/2009 | where {$_.ObjectClass -eq 'user'} | FT Name,ObjectClass -A

Additional information

For a full explanation of the parameters that you can pass to Search-ADAccount, at the Active Directory module command prompt, type Get-Help Search-ADAccount –detailed, and then press ENTER.