Fixed logic
This commit is contained in:
parent
b82d93eb0e
commit
137b933ec1
@ -4,9 +4,9 @@ if (!($cred)) {
|
|||||||
$cred = Get-Credential -Message "Enter your domain admin login:"
|
$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
|
$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'
|
$CSVPATH = 'C:\Users\eeckert\Downloads\AD-ToDelete.csv'
|
||||||
$computers = get-adcomputer -filter {(Enabled -eq $False)} -properties passwordlastset | where passwordlastset -le (get-date).adddays($AgedOutDays)
|
$computers = get-adcomputer -filter { (Enabled -eq $True) } -properties passwordlastset | where passwordlastset -le (get-date).adddays($AgedOutDays)
|
||||||
|
|
||||||
foreach ($computer in $computers) {
|
foreach ($computer in $computers) {
|
||||||
$Output = 'Moving ' + $computer.name + ' to disabled OU.'
|
$Output = 'Moving ' + $computer.name + ' to disabled OU.'
|
||||||
|
Loading…
Reference in New Issue
Block a user