Sunday, September 2, 2012

How to find Non-active laptop or computer records in effective directory?


Do you know how can we do this? Either we question the AD to get the details by composing value in C# or personally examine the AD for the non-active records. But, there is another easy way which will get this details without any big initiatives. Yes, using Powershell program
  1. $COMPAREDATE=GET-DATE  
  2. $NumberDays=90   
  3. $CSVFileLocation='C:\TEMP\OldComps.CSV'   
  4. 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   


You have to provide the days - the timeline of inactive accounts and where to save the output of inactive accounts list.


No comments:

Post a Comment