Quantcast
Channel: PowerShell General
Viewing all articles
Browse latest Browse all 10624

finding machines in AD

$
0
0

I have this code which users on this forum helped me write.  

 

$sourceOU = 'OU=InactiveComputers,DC=Acme,DC=com'

Set-QADPSSnapinSettings -DefaultSizeLimit 0

$old = (Get-Date).AddDays(+90).ToFileTime()

$ldapFilter = '(pwdLastSet<={0})' -f $old

Get-QADComputer -LdapFilter $ldapFilter -SearchRoot $sourceOU -IncludedProperties pwdLastSet -SizeLimit 9000 | Out-File "c:\temp\GoodMachines2.txt"

 

I'm trying to find machines in the InactiveOU that actually "Have" been active in AD in the past 90 days.  My problem is when I run this I get thousands of computers and I know that is not accurate.

 

This code compiles and runs but it is doing what I think?  Namely, show me machines have have been active in the past 90 days?

 

 


Viewing all articles
Browse latest Browse all 10624

Trending Articles