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

Exclude OU not working

$
0
0

I have this code that will get all users from AD

 

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

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

Get-QADUser -LdapFilter $ldapFilter  -SizeLimit 5000

 

This returns 1,300 users.

 

 

 

But when I run this it too returns 1,300 users

 

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

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

 Get-QADUser -LdapFilter $ldapFilter  -SizeLimit 50000  | Where-Object {$_.DN -notmatch '_TRAIN'}

 

We have about 200 users in TRAIN so I should only see 1,100 users.   Both pieces of code run fine without errors.  How come the exclude is not working?

 

 


Viewing all articles
Browse latest Browse all 10624

Latest Images

Trending Articles



Latest Images