Jump to content

Recommended Posts

Posted

Hi

 

I am trying to query a lastlogonstamp for all computers on my domain in Active Directory so that I can delete old computer entries where needed that havent been logged on since the last school term.

However I cannot seem to find this in AD. Is this even possible? I can do it from a user point of view but not computer.

I did start to use a program called truelogon however I still beleive that there must be a way of doing this in AD. Is it possible?

Posted

This works great! Cjwdev | AD Info - Active Directory Reporting Tool

 

If you like powershell, you could also use this:

 

# Uses Quest Active Roles

# Free to download http://www.quest.com/powershell/activeroles-server.aspx

#

# Special Thanks to Mladen Milunovic for his comments that improved the Script!

#

# List all computers that have been

# Inactive in "Active Directory"(Boy THERE'S a play on words!)

# for a specified Number of Days

#

# New version exports the Data to a CSV file and removes limit

# on number of Computers listed (default is 1000)

#

$COMPAREDATE=GET-DATE

#

# DO NOT RUN THIS IN PRODUCTION. TEST IT FIRST and use it as

# a REFERENCE tool. AUTO PURGING OF COMPUTER ACCOUNTS is

# DANGEROUS and SILLY.

#

# But this little query might help you weed out accounts

# of potentially dead systems in Active Directory

#

#

# Number of Days to see if account has been active

# Within

#

$NumberDays=90

#

$CSVFileLocation='C:\TEMP\OldComps.CSV'

#

#

GET-QADCOMPUTER -SizeLimit 0 -IncludedProperties LastLogonTimeStamp | where { ($CompareDate-$_.LastLogonTimeStamp).Days -gt $NumberDays } | Select-Object Name, LastLogonTimeStamp, OSName, ParentContainerDN | Sort-Object ModificationDate, Name | Export-CSV $CSVFileLocation

#

#

  • Thanks 1

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



×
×
  • Create New...