Add or change Ownership of a Office365 mailbox

This is one of the strange behaviour in O365, you might had seen this error while trying to change the ownership of a O365 mailbox as

You don’t have sufficient permissions. This operation can only be performed by a manager of the group.

To resolve this error, connect to O365 via PowerShell (how-to) to change the ownership

Set-DistributionGroup “IT Support Mailbox” -ManagedBy “” -BypassSecurityGroupManagerCheck

Unable to remove mailbox delegation members from office365 shared mailbox

Connect to Office365 via PowerShell (how-to)

Remove-MailboxPermission “IT Share Mailbox” -User “” -AccessRights FullAccess

Access Office365 through PowerShell

I had some hard times to setup PowerShell access to Office365, so I summarized the steps below to successfully setup.

Step 1: Download and install Microsoft Online Services Sign-In Assistant

Step 2: In services.msc, start “Windows Remote Management (WS-Management)” service

Step 3: Start PowerShell as Administrator and execute following

Set-ExecutionPolicy RemoteSigned


Step 4: Follow the steps mentioned in the below microsoft article to get connected to Office365 through PowerShell


$UserCredential = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange 
-Credential $UserCredential -Authentication Basic -AllowRedirection

Import-PSSession $Session

How to connect to Exchange Online via PowerShell

By default, Windows PowerShell Remote Access is disabled in Windows 7 SP1, so you will get the below error while trying to connect Exchange Online via PowerShell

 PS C:\Windows\system32> $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $UserCredential -Authentication Basic -AllowRedirection

[] Connecting to remote server failed with the following error message : The WinRM client received an HTTP bad request status (400), but the remote service did not include any other information about the cause of the failure. For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (System.Manageme….RemoteRunspace:RemoteRunspace) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionOpenFailed


To resolve this issue, open PowerShell with ‘Run as Administrator’ privilege

1. Check winrm status by Get-service winrm

2. If status of winrm is stopped (needs to be running), execute enable-PSremoting -force


You can achieve the same result by opening services.msc and starting the service – ‘Windows Remote Management (WS-Management)’

Note: Even if you still receive the same error after enabling WinRM, then you are probably typing domain\username instead of in the credentials window popup screen.