diff --git a/Disable-OldPC.ps1 b/Disable-OldPC.ps1 index 72227a7..f12897a 100644 --- a/Disable-OldPC.ps1 +++ b/Disable-OldPC.ps1 @@ -4,9 +4,9 @@ if (!($cred)) { $cred = Get-Credential -Message "Enter your domain admin login:" } -$AgedOutDays = -365 #store this as a negative number. How many days back should the PC have changed its password - $CSVPATH = 'C:\Users\eeckert\Downloads\AD-ToDelete.csv' -$computers = get-adcomputer -filter {(Enabled -eq $False)} -properties passwordlastset | where passwordlastset -le (get-date).adddays($AgedOutDays) +$AgedOutDays = -270 #store this as a negative number. How many days back should the PC have changed its password +$CSVPATH = 'C:\Users\eeckert\Downloads\AD-ToDelete.csv' +$computers = get-adcomputer -filter { (Enabled -eq $True) } -properties passwordlastset | where passwordlastset -le (get-date).adddays($AgedOutDays) foreach ($computer in $computers) { $Output = 'Moving ' + $computer.name + ' to disabled OU.'