Was this page helpful?
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Finding Inactive or Unused Computers

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 inactive or unused computers.

The following example is a sample script for finding inactive or unused computers in the Fabrikam.com domain:

$lastSetdate = [DateTime]::Now - [TimeSpan]::Parse("45")
Get-ADComputer -Filter {PasswordLastSet -le $lastSetdate} -Properties passwordLastSet -ResultSetSize $null | FT samaccountname,PasswordLastSet

A script is a series of Active Directory PowerShell cmdlets. For more information about running Active Directory PowerShell scripts, see Running Windows PowerShell Scripts (http://go.microsoft.com/fwlink/?LinkID=119588).

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

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

Community Additions

© 2015 Microsoft