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

Reply To: Pulling ADUser Info

$
0
0

Just for giggles, try it like this. The -Filter parameters to the AD cmdlets actually accept strings, not ScriptBlocks (though all the examples show the wrong syntax, which can be confusing.) Sometimes they don’t work the way you’d expect when you pass in a ScriptBlock and allow it to be converted automatically to a string.

Get-ADUser -Properties * -Filter "Name -eq '$user' -or SamAccountName -eq '$user' -or SN -eq '$user'" |
Select-Object Name, EmailAddress, SAMAccountName, SN |
Format-List

Viewing all articles
Browse latest Browse all 13067

Trending Articles