Export (0) Print
Expand All

Finding Users Who Have Not Logged on Recently

Updated: February 28, 2009

Applies To: Windows Server 2008 R2

This topic explains how to use the Active Directory module for Windows PowerShell to find users who have not logged on to the system recently.

The following example demonstrates how to find inactive user accounts:

Search-ADAccount -AccountInactive | where {$_.ObjectClass -eq 'user'} | FT Name,ObjectClass –A

The following example demonstrates how to find user accounts that have been inactive for 90 days:

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

The following example demonstrates how to find user accounts that have been inactive since 10/15/2008:

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

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.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft