How to Remove members from Company Administrator Role Group in O365 using Powershell

My name is Jason and in this article I would like to share “How to remove members from Company Administrator Role Group in O365 using powershell” in two phases.

Pre-Requisites

1. Download and Install Azure PowerShell for office 365

2. Connect to office 365 Azure AD using the command Connect-Msolservice

Step 1 – Capture Phase 1

Get the Microsoft Online Roles using the command Get-MsolRole.

What do we capture : Once the command is performed capture the Object ID of the MsolRole

image
Figure 1: Get-MsolRole

Step 2 – Capture Phase 2

Now we need to find out the members of company administrator Role, So Run the command Get-MsolRoleMember -RoleObjectId 62e90394-69f5-4237-9190-012177145e10 | fl

What do we capture here : When we perform this command capture the ObjectId of the MsolMember

image
Figure 02: Get-MsolRoleMember

Step 3 – Final Execution

Now run the command Remove-MsolRoleMember -RoleObjectId 62e90394-69f5-4237-9190-012177145e10 -RoleMemberObjectId 4903c4f5-0d93-430d-a22f-bed91dc9e367

image
Figure 3: Remove-MsolRoleMember

Step 4 – Confirm using the command Get-MsolRoleMember -RoleObjectId 62e90394-69f5-4237-9190-012177145e10 | fl

image
Figure 4: Get-MsolRoleMember

I hope it helps.

============================================

Jason
Team@MseXchangeTeam.in

Tagged , , , , . Bookmark the permalink.

Comments are closed.