Thursday, May 11, 2017

Finding Inactive Computers in Active Directory

Trying to clean up your active directory?

Here is a quick little script/command to find inactive computers from active directory.

This uses the server command dsquery.

Open a command prompt or Powershell on the server.

The example is:

dsquery computer -inactive 7 -limit 200

This will display a list of up to 200 computers from active directory that have not been logged into in the last 7 weeks.

Adjust -inactive xx -limit xxx as needed for your domain.

Note: The dsquery command can be used on active directory users as well.


~Michael


No comments:

Post a Comment