Get inactive computers in domain using command line

2017-12-07T11:13:40+00:00 August 15th, 2012|Azure, Cloud, Windows|

Here is a quick command that can be run on the domain to see if there are are computer accounts in Active Directory that have been inactive for over a month:

dsquery computer "OU=OU NAME,DC=DOMAIN,DC=LOCAL" -inactive 4 -limit 0  

The inactive value increases by weeks so two months would be 8 and so on.

You can narrow down the OU by simply putting in the distinguished name of the OU in the “”