Forum Discussion
Gianni88
Nov 20, 2019Copper Contributor
PowerShell command to export user's manager name
Dear all, I would like to know what is the powershell command to get this information : First Name Last Name Email address JobTitle Manager report 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
Nov 23, 2019
Hi Gianni88 ,
in which context are you working? SharePoint online? Azure Active Directory?
Gianni88
Nov 23, 2019Copper Contributor
Hi Federico,
Thank you for your reply.
I do have an Active Directory on permise synchronized to Azure. I hope it can helps you.
Gianni
Thank you for your reply.
I do have an Active Directory on permise synchronized to Azure. I hope it can helps you.
Gianni
- Nov 23, 2019
Hi Gianni88
you can try using Azure Active Directory PowerShell for Graph.
- first of all, install it following this guide ( Install-Module AzureAD )
- Connect to Azure AD using
$AzureAdCred = Get-Credential Connect-AzureAD -Credential $AzureAdCred- Then you can use Get-AzureADUser command. ΓΉ
The result could be something like this
Connect-AzureAD -Credential $AzureAdCred $output = @() $users = Get-AzureADUser -All $true foreach ($user in $users) { $manager = Get-AzureADUserManager -ObjectId $user.ObjectId $data = New-Object -TypeName psobject $data | Add-Member -MemberType NoteProperty -Name Name -Value $user.GivenName $data | Add-Member -MemberType NoteProperty -Name Surname -Value $user.Surname $data | Add-Member -MemberType NoteProperty -Name Mail -Value $user.Mail $data | Add-Member -MemberType NoteProperty -Name JobTitle -Value $user.JobTitle $data | Add-Member -MemberType NoteProperty -Name Manager -Value $manager.DisplayName $output += $data } $output | Format-TableSave it in a .ps1 file and try it π
I just follow this approach.
Cheers,
Federico
- Gianni88Nov 30, 2019Copper Contributor
I tried to connect to Azure Active Directory PowerShell for Graph. but I am not able to get in. Maybe is because we use in our company MFA security.
Are there any others commands ?
Thanks.
Gianni
- Nov 30, 2019