Managing Exchange Calendars
1#If not installed already
2Install-Module ExchangeOnlineManagement
3#Import
4Import-Module ExchangeOnlineManagement
5#Connect
6Connect-ExchangeOnline -UserPrincipalName <UPN>
7
8# Remove AccessRights from a user
9Remove-MailboxFolderPermission -Identity target@company.com:\Calendar -User user@company.com
10# Grant AccessRights to a user
11Add-MailboxFolderPermission -Identity target@company.com:\Calendar -User user@company.com -AccessRights Owner
12# See who currently has folder permissions to a user's calendar
13Get-MailboxFolderPermission -Identity target@company.com:\Calendar
I haven't tested these since 2021:
1# Connect to Exchage
2Import-Module ExchangeOnlineManagement
3Connect-ExchangeOnline -UserPrincipalName <UPN>
4
5# Get a list of all mailbox aliases
6# Source: https://docs.microsoft.com/en-us/powershell/module/exchange/get-mailbox?view=exchange-ps
7$users = Get-Mailbox | Select -ExpandProperty Alias
8
9# Add AccessRights for a user to all mailboxes
10# Source: https://docs.microsoft.com/en-us/powershell/module/exchange/add-mailboxfolderpermission?view=exchange-ps
11Foreach ($user in $users) {Add-MailboxFolderPermission $user":\Calendar" -User <UPN> -AccessRights PublishingEditor}
12
13# Set AccessRights to a user for all mailboxes. You would do this if AccessRights already exist and you need to overwrite them.
14# Source: https://docs.microsoft.com/en-us/powershell/module/exchange/set-mailboxfolderpermission?view=exchange-ps
15Foreach ($user in $users) {Set-MailboxFolderPermission $user":\Calendar" -User <UPN> -AccessRights PublishingEditor}
16
17# Get the current access rights this user has for all mailboxes.
18# Source: https://docs.microsoft.com/en-us/powershell/module/exchange/get-mailboxfolderpermission?view=exchange-ps
19Foreach ($user in $users) {Get-MailboxFolderPermission $user":\Calendar" -User <UPN>}