How to get a list of all Global Admins in Office 365 using PowerShell

This is a quick post on how to retrieve all Global Admins within your Office 365 organisation using PowerShell.

First connect to Office 365 using Powershell and then run the below commands:

$role = Get-MsolRole -RoleName "Company Administrator"

Get-MsolRoleMember -RoleObjectId $role.ObjectId | select DisplayName,EmailAddress,IsLicensed,LastDirSyncTime,RoleMemberType | export-csv c:\temp\GlobalAdmins.csv -nti 

Leave a Reply

Your email address will not be published. Required fields are marked *