Quantcast
Channel: Tachytelic.net
Viewing all articles
Browse latest Browse all 210

List all Office 365 Global Administrators with Powershell

$
0
0

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

The post List all Office 365 Global Administrators with Powershell appeared first on Tachytelic.net.


Viewing all articles
Browse latest Browse all 210

Trending Articles