Export Reporting Manager Details

Modified on Tue, 30 Jun at 4:48 PM

# Install and import the AzureAD module if not already installed

# Install-Module -Name Az -AllowClobber -Force -Scope CurrentUser

# Import-Module Az -Force


# Connect to Office 365

Connect-AzAccount


# Specify the user's UPN (User Principal Name)

$userUPN = "archana.goel@jkmail.com"


# Get the user and display the reporting manager

$user = Get-MsolUser -UserPrincipalName $userUPN

if ($user) {

    if ($user.ManagerUserPrincipalName) {

        $reportingManager = Get-MsolUser -UserPrincipalName $user.ManagerUserPrincipalName

        Write-Host "$userUPN's reporting manager is: $($reportingManager.UserPrincipalName)"

    } else {

        Write-Host "$userUPN does not have a reporting manager."

    }

} else {

    Write-Host "User $userUPN not found."

}


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article