Skip to content

Instantly share code, notes, and snippets.

@Trimad
Last active April 13, 2022 00:26
Show Gist options
  • Save Trimad/c26d5946a80b315a7671986c0bb7ea59 to your computer and use it in GitHub Desktop.
Save Trimad/c26d5946a80b315a7671986c0bb7ea59 to your computer and use it in GitHub Desktop.
PowerShell commands for managing calendar permissions.
# Tristan Madden
# 2021-09-16
# trimad.github.io
# Get connected to Exchage Online Management
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName <UPN>
# Get a list of all mailbox aliases
# Source: https://docs.microsoft.com/en-us/powershell/module/exchange/get-mailbox?view=exchange-ps
$users = Get-Mailbox | Select -ExpandProperty Alias
# Add AccessRights for a user to all mailboxes
# Source: https://docs.microsoft.com/en-us/powershell/module/exchange/add-mailboxfolderpermission?view=exchange-ps
Foreach ($user in $users) {Add-MailboxFolderPermission $user":\Calendar" -User <UPN> -AccessRights PublishingEditor}
# Set AccessRights to a user for all mailboxes. You would do this if AccessRights already exist and you need to overwrite them.
# Source: https://docs.microsoft.com/en-us/powershell/module/exchange/set-mailboxfolderpermission?view=exchange-ps
Foreach ($user in $users) {Set-MailboxFolderPermission $user":\Calendar" -User <UPN> -AccessRights PublishingEditor}
# Get the current access rights this user has for all mailboxes.
# Source: https://docs.microsoft.com/en-us/powershell/module/exchange/get-mailboxfolderpermission?view=exchange-ps
Foreach ($user in $users) {Get-MailboxFolderPermission $user":\Calendar" -User <UPN>}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment