Office 365: Find All SharePoint Online Administrators using PowerShell

Requirement: Get All SharePoint Online Administrators of the Office 365 tenant.

How to Check If a User is SharePoint Online Administrator in Office 365?
To find if a user is SharePoint Online Administrator, do the following:
  1. Login to Office 365 Admin Center: https://admin.microsoft.com
  2. Expand Users >> Active Users
  3. Use the Search and the user. Click on the user from results grid, which opens user properties.
  4. In user properties page, under "Roles", You'll find "SharePoint Administrator"
While these steps are quite simple, it would be cumbersome to go to each user's properties and check if he/she has SharePoint Administrator role, isn't it?

PowerShell to Get a List of SharePoint Online Administrators
This PowerShell script lists all SharePoint Administrators from Office 365 tenant. Use Azure AD PowerShell module to execute this script.
#Connect to Azure AD
Connect-MSOLService 

#Get SharePoint Online Administrators Role
$RoleID = (Get-MsolRole -RoleName "SharePoint Service Administrator").ObjectID

#Get All Users with SharePoint Admin Role 
Get-MsolRoleMember -RoleObjectId $RoleID | Format-table –AutoSize

This prompts for login and gets you all SharePoint Administrators of the tenant.
get sharepoint administrators in office 365 sharepoint online
Office 365: Find All SharePoint Online Administrators using PowerShell Office 365: Find All SharePoint Online Administrators using PowerShell Reviewed by Salaudeen Rajack on August 16, 2018 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.