Matthew McDonald
asked on
Powershell: Output displayname of "Manager" attribute when querying Active Directory
I'm trying to pull a report from Active Directory for which I am including the manager attribute. As Active Directory stores the DN of the manager in this attribute, that's what I get in my report.
As I understand it, Powershell has a means to perform calculated properties when piping to the Select-Object cmdlet. Can you use this to translate the manager name to its displayname by running a subsequent Get-ADUser?
I'm looking for something like the following, but I just can't get the syntax down correctly.
Get-ADUser <params snipped> | Select-Object Name, @{n="ManagerName";e={Get-A DUser -Identity $_.Manager}}
Is this possible? Am I just messing up the syntax? I am having a very difficult time in searching online for how to accomplish something like this.
As I understand it, Powershell has a means to perform calculated properties when piping to the Select-Object cmdlet. Can you use this to translate the manager name to its displayname by running a subsequent Get-ADUser?
I'm looking for something like the following, but I just can't get the syntax down correctly.
Get-ADUser <params snipped> | Select-Object Name, @{n="ManagerName";e={Get-A
Is this possible? Am I just messing up the syntax? I am having a very difficult time in searching online for how to accomplish something like this.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I have the same command which you posted here.. I think you copied the command before I updated it.. :-)
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for mcdonamw79's comment #a39271876
Assisted answer: 500 points for Subsun's comment #a39271827
for the following reason:
Using Subsun's reply I formulated the correct answer.
Accepted answer: 0 points for mcdonamw79's comment #a39271876
Assisted answer: 500 points for Subsun's comment #a39271827
for the following reason:
Using Subsun's reply I formulated the correct answer.
ASKER
Subsun corrected his answer while I was typing my own solution. Please reject my answer and set Subsun's reply to be sole answer. Thank you!
ASKER
Looks like I had the ability to re-choose the answer. I'm still pretty new to Experts-Exchange formalities. Thanks Subsun!
No worries... I am glad that you are able to fix the issue.. :-)
ASKER
BTW, I just ran your command and it did not work. I got a blank value for ManagerName but I fixed it. I need to add -Properties DisplayName on the manager side of the query.
Get-ADUser <params snipped> -Properties Manager | Select-Object Name, @{n="ManagerName";e={(Get-
Thanks for your quick help!