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
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-Table
Save 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
- Gianni88Dec 02, 2019Copper Contributor
Hi Federico,
As we use MFA (Multa Factor Authentification), I am not able to get into Powershell. I tried to follow this link (without success) : https://docs.microsoft.com/en-us/powershell/exchange/office-365-scc/connect-to-scc-powershell/mfa-connect-to-scc-powershell?view=exchange-ps
Do you know which command I need to run to connect to Powershell Azure (with MFA) ?
Thanks.
Gianni