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

Reply To: Getting contents of a csv and for each line, search a like or contains that

$
0
0

There is no asterisk after your $UserObject. While you are still testing, you can output to the console so you validate the search is valid, something like this:

ForEach ($UserObject in $UserObjects) { 
    $filter = "*{0}*" -f $UserObject
    "Searching for {0}" -f $filter
    Get-ADuser -filter {surname -like $filter} | FT Name
}

Viewing all articles
Browse latest Browse all 13067

Trending Articles