AD: Get Display Name from user name (SAMAccountName)


I read PowerShell.com’s blog get display name out of user name in a one line.

Here is a quick way to find the current user in your Active Directory and retrieve account information such as the display name:

([adsisearcher]"(samaccountname=$env:USERNAME)").FindOne().Properties['displayname']

I have even found easier way than using Active Directory PowerShell Module.

(Get-ADUser $env:USERNAME).name

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s