Author Posts

January 1, 2012 at 12:00 am

by daytime10 at 2012-12-17 11:16:54


I am using Quest AD Cmdlets to do some searches but the results dont make sense, anyone see anything wrong with this code?

Get-QADUser -enabled -SizeLimit 0 -IncludedProperties samaccountname,extensionattribute10,extensionattribute12 | Where-Object {$_.extensionattribute10 -like $searchdate -and $_.extensionattribute12 -eq "B" -or $_.extensionattribute12 -eq "D" -or $_.extensionattribute12 -eq "F" -or $_.extensionattribute12 -eq "H" } | Foreach-Object{$names += $_.samaccountname}

Basically I want to search for accounts that have an extensionattribute10 equal to something AND any of the following conditions for extensionattribute12


by coderaven at 2012-12-17 11:54:30

It looks like your -ORs need to be in () so that they are calculated in addition to the $searchdate
Where-Object {$_.extensionattribute10 -like $searchdate -and ($_.extensionattribute12 -eq "B" -or $_.extensionattribute12 -eq "D" -or $_.extensionattribute12 -eq "F" -or $_.extensionattribute12 -eq "H" )}
Thats just my guess

by daytime10 at 2012-12-17 12:56:10

Your guess was correct