• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Tachytelic.net

  • Get in Touch
  • About Me

List all Office 365 Global Administrators with Powershell

July 25, 2019 by Paulie 1 Comment

Time needed: 2 minutes.

Getting a list of all Office 365 Global administrators with Powershell is easy. Here is how to do it with a simple one liner.

  1. Open a Powershell session and connect to Office 365

    At a PowerShell Prompt connect to Office 365 with the command:
    Connect-MsolService

  2. Authenticate with Office 365

    Sign in to Office 365 when prompted with a Global Administrator account.

  3. List Global Admins with the Get-MsolRoleMember cmdlet

    Use the following command to list all global admins:
    Get-MsolRoleMember -RoleObjectId $(Get-MsolRole -RoleName "Company Administrator").ObjectId

If Connect-MsolService does not work for you, then you need to follow these instructions to install the Azure Active Directory Module.

If you’d like to export the list of Global Administrators to a CSV file instead, use a PowerShell command like the following:

Get-MsolRoleMember -RoleObjectId $(Get-MsolRole -RoleName "Company Administrator").ObjectId |
Select-Object -Property DisplayName,EmailAddress |
Export-Csv -NoTypeInformation -Path D:\GlobalAdmins.txt

Filed Under: Office 365 Tagged With: Office 365, Powershell

Reader Interactions

Comments

  1. Kathy says

    March 2, 2021 at 3:51 pm

    Thanks for sharing. Also, you can try below script to generate multiple Office 365 admin reports based on your requirement. For example,
    -All admins report
    -Role based admin report
    -Get admin roles for a specific user(s)
    -Get all admins with a specific role(s).
    https://o365reports.com/2021/03/02/Export-Office-365-admin-role-report-powershell/

Leave a Reply Cancel reply

Primary Sidebar

Link to my LinkedIn Profile
Buy me a coffee

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 253 other subscribers.

Go to mobile version