Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Get-ADUser -Filter string array

$
0
0

Just trying to simply get the Filter param for Get-ADUser to accept an array of strings for input but having a difficult time at it. Not familiar with tackling with arrays on Powershell. I figured it'd be just as easy as this:

$userarray = @("user1","user2","user3")
 
Get-ADUser -Filter {name -eq $userarray}

The funny thing is, it will accept the array var without error, but no output given (as if it found nothing matching). Verbose nor Debug params show anything, so I'm not sure if it's just parsing the array in a strange manner or not. It will take the var if it's just a single string value.

In any case, if this isn't the way an array should be used in this situation, than what's best practice?

Preemptive thanks!


Viewing all articles
Browse latest Browse all 13067

Trending Articles