Hi @Rick Angel
Thanks for the reply. After running this command how do I see the list of computers more than 30 days inactive? This command run by itself seems to list all computers in the AD. Then I after seeing the list I would need to be able to disable them. I could use "Set-ADComputer -Remove" to delete the computers but I would prefer to disable them first and delete them later. Do you have any suggestions?
#The first command let you to disable all inactive computer since 30 days
Get-ADComputer -filter (Enabled -eq '$True') -Properties PasswordLastSet | Where {$_.Passwordlastset -ge (Get-date).AddDays(-30)} | Disable-ADAccount
#The second command let you to delete disabled and inactive computer after 60 days
Get-ADComputer -filter filter (Enabled -eq '$false') -Properties PasswordLastSet | Where {$_.Passwordlastset -ge (Get-date).AddDays(-60)} | Remove-ADobject
You can customize the command above following to your needs.
----------
please don't forget to mark helpful reply as answer