Forum Discussion
PowerShell command to export user's manager name
- Dec 03, 2019
Hi Gianni88
it is normal you can't find the Manager field.
The foreach make the work for you, expanding manager property 🙂
Please, debug your scripts in ISE or using output messages 🙂
Cheers,Federico
Hi Gianni88 ,
ok it's easy 🙂
You need to use just
Connect-AzureAD
instead of
$AzureAdCred = Get-Credential
Connect-AzureAD -Credential $AzureAdCred
the second part of the script it's the same 🙂
Cheers,
Federico
Hi Federico,
Thanks, step by step we move forward, I am in now 🙂
When I run the ps1 file, it does not display anything (look at the attachment).
What I am doing wrong ?
Thanks.
- Gianni88Dec 03, 2019Copper Contributor
Found this powershell command also, it can help :
Get-ADUser -Filter * -SearchBase 'OU=xxxx,OU=xxxxxx,DC=xxx' -Properties Manager, Title |
Select-Object -Property Name, Title, @{label='Manager';expression={$_.manager -replace '^CN=|,.*$'}}It works perfectly
- Gianni88Dec 03, 2019Copper Contributor
- Dec 03, 2019
Hi Gianni88
it is normal you can't find the Manager field.
The foreach make the work for you, expanding manager property 🙂
Please, debug your scripts in ISE or using output messages 🙂
Cheers,Federico
- Gianni88Dec 03, 2019Copper Contributor
Thanks, Better and better now. However, I do not have the Manager name (see below) :
It is possible to extract into a csv file ?
Thanks.
Gianni
- Dec 03, 2019
Hi Gianni88 ,
try to run
> $users = Get-AzureADUser -All $true > $users
after connect 🙂
Are there users in $users?Cheers,
Federico