Код:
$wcdate = "{0:yyyMMddHHmmss}.Z" -f (Get-Date).AddDays(-28)
$lldate = (Get-Date).AddDays(-28).ToFileTime()
Get-ADComputer -Filter "whenChanged -lt '$wcdate' -and lastlogondate -lt '$lldate' -and OperatingSystem -notlike '*Server*'" |
Set-ADComputer -Enabled $false -PassThru | Move-ADObject -TargetPath 'ou=charlotte,dc=iammred,dc=net'