I have run into a bit of a snag, I want to disable/delete computer objects depending on how long it has been since they were last logged onto. It seems to work fine, I got my list of computer objects through the following code.
$systemListdisable = Get-ADComputer -SearchBase $srcOU -Filter {LastLogonTimeStamp -lt $date -and Description -ne "Exempt"} -Properties LastLogonTimeStamp
Basically I want it to include the object unless the Description on that object is "Exempt". The issue seems to be that the code "-and Description -ne "Exempt"" seems to also exclude objects that have no description also. I don't see how this code would do that, anyone have any issue similiar to this?
If I use the code below it will disable the object even if the description is blank.
$systemListdisable = Get-ADComputer -SearchBase $srcOU -Filter {LastLogonTimeStamp -lt $date} -Properties LastLogonTimeStamp
$systemListdisable = Get-ADComputer -SearchBase $srcOU -Filter {LastLogonTimeStamp -lt $date -and Description -ne "Exempt"} -Properties LastLogonTimeStamp
Basically I want it to include the object unless the Description on that object is "Exempt". The issue seems to be that the code "-and Description -ne "Exempt"" seems to also exclude objects that have no description also. I don't see how this code would do that, anyone have any issue similiar to this?
If I use the code below it will disable the object even if the description is blank.
$systemListdisable = Get-ADComputer -SearchBase $srcOU -Filter {LastLogonTimeStamp -lt $date} -Properties LastLogonTimeStamp