Get a list of inactive computers which have not logged on to the domain in the last 12 weeks

# Inactive computers ( this will include systems not regularly used)

# Launch command prompt as administrator and run the following commands

Dsquery computer -inactive 12 -limit 500

# Lists computers inactive for over 12 weeks and returns a limit of 500 results

Dsquery computer -inactive 12 -limit 500 | dsmod computer -disabled

# Lists computers inactive for over 12 weeks and returns a limit of 500 results and disables the computer accounts

 

# Similar command can be done for users.

 

Disable inactive computers in AD

I would be tempted to run it manually in two parts.. that sounds a little cautious I know..

From your DC you can run

CMD ( as admin )
dsquery computer -inactive 8
(this lists the inactive computers- this list can include serveres!!!)

This will list the computers which have been inactive for 8 weeks or more.

Then you can choose to manually select the highlighted computers (from the query) in AD right click disable.
Or run    dsquery computer -inactive 8 | DSMOD computer -disabled yes

This will error if there is nothing to update “dsquery computer -inactive 8 | DSMOD computer -disabled yes”

I would not schedule this to run automatically.. Just in case it bins a server.. even though servers should never been offline for 8 weeks