Office 365 – Removing shared permissions to a calendar via PowerShell

Problem:

Client wanted to remove select users from a shared calendar

Solution:
(h/t IQinIT)

  1. $cred = Get-Credential
  2. $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $cred -Authentication Basic –AllowRedirection
  3. Import-PSSession $session
  4. Get-MailboxFolderPermission -Identity user@domain.com:\Calendar| Select User, AccessRights, Deny
  5. Remove-MailboxFolderPermission -Identity user@domain.com:\Calendar -User user2@domain.com