Showing posts with label Powershell for Stale Computers. Show all posts
Showing posts with label Powershell for Stale Computers. Show all posts

Thursday, February 28, 2013

PowerShell Command to Identify Stale Computers and move to specific OU


Here is the simple Power Shell Command to identify Stale Computers and move to specific OU.

$d = [DateTime]::Today.AddDays(-3600); Get-ADComputer -Filter 'PasswordLastSet -ge $d'|adobject -targetpath 'ou=disabled,dc=umatest,dc=com'

Change the highlighted parameters as required. You can run a trial test and schedule the script on DC to run daily.