≡ Menu

Powershell: Get Manager name from Active Directory

I want to write about another quick post before I sign off today. One of my friend asked me how to get Manager of a user from active directory using powershell. He seem to have tried ActiveDirectory module to get this information but it never returned any data.

So, I this post I want to provide quick one-liners using Quest AD cmdlets and built-in activedirectory cmdlets which returns the Manager attribute information from active directory.

Using Quest AD CMDlets:

Get-QADUser -Id User1 | select Manager

Using ActiveDirectory Module:

You need to note one thing when you are using ActiveDirectory module. Most cmdlets in this module never returns all properties by default. You need to explicitly ask for attribute when using the cmdlets in this module.

So, Get-ADUser -Id User1 | select Manager will not work as there won’t be any parameter called Manager in default output. You should use something like below to get the data.

Get-ADUser -Id User1 -Properties Manager | select Manager            

OR            

Get-ADUser -Id User1 -Properties * | select Manager

Hope this helps…