Jump to content

Recommended Posts

Posted
does anyone have a safe peice of software that will query active directory and generate a report on computers that have been inactive for over a period of time.
Posted (edited)

You can use dsquery to get a list eg. to find all computers unused for 8 weeks

 

dsquery computer -inactive 8 -limit 0

 

To delete the computers

 

dsquery computer -inactive 8 -limit 0 | dsrm

Edited by somabc
  • Thanks 1
Posted

thanks somabc,

 

Could you give some detail about the number after inactive and limit? I assume in your example 8 means it will show any computers inactive for over 8 weeks, and no limit ont he number of results?

  • 3 months later...
Posted

I use oldcmp and run this batch file

 

oldcmp -report -age 120 -format csv

 

You can change the format and age, I then just go through Active Directory and disable and move the accounts to another OU. You can get it to disable and delete the accounts I think but I wanted a little more control. Did 1800 machines the other week. You can download oldcmp if you just Google it.

Posted

I Have successfully used Quest AD Cmdlets for this task.

 

You will need to install and run the Quest Powershell console, these commands do not seem to run in the standard shell even with the cmdlets installed. A bit like exchange 2010 seems to need its own shell.

 

Quest AD Cmdlets are free to download from PowerShell Commands (CMDLETs) for Active Directory by Quest Software

 

get-qadcomputer -IncludeAllProperties | Where-Object { $_.lastlogon -lt (get-date).AddDays(-90) }

Outputs to shell console

 

get-qadcomputer -IncludeAllProperties | Where-Object { $_.lastlogon -lt (get-date).AddDays(-90) } | select-object Name, ParentContainer, Description, pwdLastSet | export-csv c:\outdated.csv

Outputs to csv

 

get-qadcomputer -IncludeAllProperties | Where-Object { $_.lastlogon -lt (get-date).AddDays(-90) } | Move-QADObject -to my.corp/obsolete

Moves to alternate OU

 

tack this to the end to disable the accounts

| disable-QADComputer

 

Check Locate obsolete computer records in AD « Dmitry’s PowerBlog: PowerShell and beyond for more.

 

And QAD cmdlets reference - PowerGUI Wiki

 

BoX

  • Thanks 1
Guest TheLibrarian
Posted
Me too & can't think of anything better (it's from joeware.net amongst some other very good free utils)

 

I love the warranty on the utilities he offers... warranty and license

  • 4 years later...
  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



  • 158 What is your preferred operating system (PC)

    1. 1. Operating systems:


      • MacOS
      • Windows 10
      • Windows 11
      • Windows Vista
      • ChromeOS
      • Other (reply)

×
×
  • Create New...