Thursday, February 24, 2011

Finding Inactive or Unused Computers

Finding Inactive or Unused Computers

This topic explains how to use the Active Directory module for Windows PowerShell to find inactive or unused computers.

Example

The following example is a sample script for finding inactive or unused computers in the Fabrikam.com domain:
C#
$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).

Additional information

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.

No comments:

Post a Comment