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.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s