Export Office 365 User Manager and Direct Reports Using PowerShell
The objective of a Microsoft 365 Admin is to keep the data up to date. But, assigning a manager and retrieving their information has always been one of the tedious tasks.. The manager data is the significant component to create the organization chart. As various services depend on this data, it is necessary to regularly verify the manager and direct report information. Â
How to View the Azure AD Users with Manager Details:Â
Using UI: You can view the Office 365 users’ manager in the Azure AD portal. Go to Azure AD ‘Dashboard’. Select the ‘Users’ and click on the user. In the profile, you can view the ‘Manager’ under ‘Job Info’. However, getting a manager report in the Azure AD is an effort-consuming task as you can see the result of one user at a time.Â
Using PowerShell: You can use PowerShell cmdlet ‘Get-AzureADUserManager’ to get the manager information of the users. You can use the ‘Get-AzureAdUserDirectReport’ cmdlet to get the direct reports of the manager. But these cmdlets don’t contain the user data attributes. Each time you will need to run the ‘Get-AzureADUser’ cmdlet to get the user information. It isn’t easy when you want to generate different reports to meet your business requirements.
As usual, it is not that simple to quickly get a manager report from Microsoft 365 Admin Center. The administrators need a powerful Microsoft 365 reporting tool to get both managers and direct reports details seamlessly. Considering these difficulties, we have created a multipurpose script, ‘GetM365ManagerAndDirectReports.ps1′. We can discuss the script’s functionalities in detail now.Â
Script Highlights:Â
- Generates 10+ different manager reports to view the managers and direct reports status. Â
- Automatically installs the Azure AD module upon your confirmation when it is not available in your machine.Â
- Shows list of all Azure AD users and their manager. Â
- List of all Office 365 users with no manager.Â
- Allows specifying user departments to get their manager details.Â
- You can get the direct reports of the Office 365 managers.Â
- Supports both MFA and Non-MFA accounts.   Â
- Exports the report in CSV format. Â
- Scheduler-friendly. You can automate the report generation upon passing credentials as parameters.Â
Download Script: GetM365ManagerAndDirectReports.ps1
Office 365 User Manager Report – Script Execution OverviewÂ
The administrators need different types of managers’ reports to address business requirements and management activities. You can run the script with a simple execution format to get various user manager reports. Following manager reports that contain detailed attributes of both users and managers.   Â
- Get Office 365 user manager report.Â
- Users without manager report.Â
- Get Office 365 direct reports.Â
- Generate manager report for a specific department.Â
- Disabled users with manager.Â
- Unlicensed users with manager.Â
- Scheduling manager report.
You can filter  ‘DisabledUsers’ and  ‘UnlicensedUsers’ using the switch params which are discussed in the ‘More use cases’ section. These filters help to unlock the script’s full potential. We have explained the steps to supply inputs and generating reports below.  Â
Get Office 365 Users and Their Manager:Â
The Office 365 users are assigned to a manager while processing their organization profile. The manager may change based on the user role and other factors. The administrators monitor the users’ manager info to ensure the profile is updated correctly. Using our script, you can get the list of users and their manager’s name along with the significant attributes. Â
1 |
.\GetM365ManagerAndDirectReports.ps1 |
The exported Office 365 user manager report contains both users’ and managers’ information like Name, UPN, Department, Account Status and License Status.
Sample Output:Â
Get Office 365 Users Without Manager:Â
There are specific business sectors where the users don’t have a manager to report. These users can belong to any department or user category (like guest). They don’t need managers as their role in the organization is distinct. Using our script, the administrators can quickly identify users who don’t have a manager and verify their accounts. The switch param ‘UsersWithoutManager’ is used to get the users without the manager report. Â
1 |
.\GetM365ManagerAndDirectReports.ps1 -UsersWithoutManager |
The report has essential user account attributes that help the administrator decide the necessity to set up managers for them.Â
Sample Output:Â
Get Office 365 Managers and Direct Reports:Â
Manager and their direct report data is a significant report frequently requested to Admins. This data is used to construct the organization chart effectively. Using the ‘DirectReports’ switch, you can get managers and their direct reports information in a Jiffy. Â
1 |
.\GetM365ManagerAndDirectReports.ps1 -DirectReports |
The format shown above provides a list of managers and their direct reports. Also, the report shows how many direct reports the managers have, along with the direct reports names and UPNs.
Sample Output:Â
Find Office 365 Users’ Manager by Department:Â
Department managers are the driving force behind a department’s growth through achieving high levels of productivity. The administrators confirm that the department managers are available to deliver business updates. When your tenant has a large user population, you can generate manager reports based on department filters to save time.  Â
Using the ‘Department’ parameter, you can view the users available in the specific departments and their manager details. Â
1 |
.\GetM365ManagerAndDirectReports.ps1 -Department "Finance","Sales","Human Resource","R&D" |
Specifying the list of departments enclosed with quotes and separated with a comma is essential. Mention the departments of the users in the input to know their manager’s data.Â
Sample Output:Â
Get Manager Detail of Disabled Users: Â
The admin regulates the users’ off-boarding activities. These user accounts are retained as disabled accounts to preserve the data for the compliance requirements. Â
You can use the ‘DisabledUsers’ param to generate disabled users’ manager reports.  Â
1 |
.\GetM365ManagerAndDirectReports.ps1 -DisabledUsers |
The report has only disabled users and their manager information.  Â
Â
Get Office 365 Unlicensed Users and Their Managers:Â
Every Office 365 user must have at least one license to continue their work. It’s the administrators’ responsibility to make sure all users are licensed properly. The administrator assigns proper licenses to the user after confirming with the manager. Using the unlicensed users’ manager report, the administrator identifies the manager to get the license suggestions for these users.Â
1 |
.\GetM365ManagerAndDirectReports.ps1 -UnlicensedUsers |
Using the ‘UnlicensedUsers’ param, you can get only unlicensed users and their managers.Â
Scheduling Office365 Users’ Manager and Direct Reports:Â
Based on organization functionalities, you can schedule the PowerShell script to monitor the daily or periodic status of the user and manager report. To schedule the execution, you can use both MFA and non-MFA accounts. Â
To use the non-MFA admin accounts, try the format below.  Â
1 |
.\GetM365ManagerAndDirectReports.ps1 -UserName admin@contoso.com -Password (password) -DirectReports |
If the admin account has MFA, then they cannot use it directly for scheduling. Instead, you have to disable MFA based on the Conditional Access Policy to make it work.Â
Â
Office 365 User Manager Report – Additional Use Cases:Â
You can append the ‘-Disabled Users’ or ‘-UnlicensedUsers’ or both params with other parameters to filter the results further. Below are some examples to granularly filter the results.Â
- Get manager info of disabled users who don’t have an Office 365 license.Â
1 |
.\GetM365ManagerAndDirectReports.ps1 -DisabledUsers -UnlicensedUsers |
- View direct reports of disabled managers who don’t have an Office 365 license.Â
1 |
.\GetM365ManagerAndDirectReports.ps1 -DirectReport -DisabledUsers -UnlicensedUsers |
- List disabled users who don’t have an Office 365 license and a manager.Â
1 |
.\GetM365ManagerAndDirectReports.ps1 -UsersWithoutManager -DisabledUsers -UnlicensedUsers |
- Get users from different departments who don’t have a manager.Â
1 |
.\GetM365ManagerAndDirectReports.ps1 -Department "Sales","Retail" -UsersWithoutManager |
- Get direct reports of managers in a department.Â
1 |
.\GetM365ManagerAndDirectReports.ps1 -DirectReport -Department "HR" |
Â
AdminDroid: Free Tool for Detailed Office 365 Manager Reports:
Why AdminDroid is one-stop solution for Microsoft 365 manager reporting?
- Schedules and sends reports to email
- Exports data in various formats, such as CSV, HTML, PDF, etc.
- Filters data to generate fine-grained reports
- Visualizes report data to charts/AI generated graphs
- Manages multiple tenants
- User friendly UI
- Manager and other 100+ Azure AD reports available in Free Edition itself.
AdminDroid offers a free Office 365 reporting tool that provides detailed reports on Office 365 managers and direct reports.
In addition to this, the Office 365 reporting software includes a range of Office 365 dashboards and the following reports at no extra cost:
- User reports, group reports, and group membership reports
- Subscription and license reports
- User login activity monitoring
- License changes, password changes, group membership changes, and more.
AdminDroid goes beyond just Office 365 reporting – it also provides 1600+ reports and 30+ smart dashboards that deliver valuable insights into every aspect of your Office 365 environment, including reporting, auditing, analytics, usage statistics, security, and compliance. Download Microsoft 365 reporting tool and experience the power of AdminDroid’s reporting and auditing capability.
We hope this script helps to get the users’ manager report and managers’ direct reports effectively. If there is still something unclear to you, please leave a comment, and we will address your questions. Â