HOWTO: Get-ADUser for Display Names

When working with Active Directory from PowerShell, you’ll often find yourself using the Get-ADUser cmdlet.  You’ll find yourself often looking up user accounts by typing something like Get-ADUser jsmith which works just fine as jsmith is the samaccountname for a user in Active Directory.  But what happens if you want to look up by Display Name?  Or more commonly, you are given a list of employees in a CSV and you need to look up those AD accounts. You’ll find that if you try to supply the Display name field in the same way, you’ll get an “Object not found” error.  Example:

Get-ADUser jsmith <- Works
Get-ADUUser “John Smith” <- Fails

So, how do you use the Get-ADUser cmdlet to look up users if all you have is their display name?  Like this:

Get-ADUser -Filter{ DisplayName -eq “John Smith” }


It has come up enough times I stumble over myself each time that I figured other people must be having the same challenge so I figured I’d document it.


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.