Skip to content

Instantly share code, notes, and snippets.

@wgroenewold
Last active September 28, 2022 09:49
Show Gist options
  • Save wgroenewold/f19bd551f27cfe95698e4229ed14018e to your computer and use it in GitHub Desktop.
Save wgroenewold/f19bd551f27cfe95698e4229ed14018e to your computer and use it in GitHub Desktop.
Set all default permissions for all calendars in O365
Connect-ExchangeOnline -UserPrincipalName chris@contoso.com
$Mailboxes = Get-Mailbox -ResultSize Unlimited -Filter {(RecipientTypeDetails -eq "UserMailbox") -and (Name -ne "beheer")}
foreach($Mailbox in $Mailboxes){$Calendar = Get-Mailbox -Identity "$($Mailbox.Name)" | Get-MailboxFolderStatistics -FolderScope calendar | sort-object Date; Set-MailboxFolderPermission -identity "$($Mailbox.Name):\$($Calendar[0].Name)" -AccessRights LimitedDetails -User Default; foreach ($User in $Mailboxes){if($User -ne $Mailbox){Set-MailboxFolderPermission -identity "$($Mailbox.Name):\$($Calendar[0].Name)" -AccessRights Editor -User $($User.Name)}}}
foreach($Mailbox in $Mailboxes){$Calendar = Get-Mailbox -Identity "$($Mailbox.Name)" | Get-MailboxFolderStatistics -FolderScope calendar | sort-object Date; Set-MailboxFolderPermission -identity "$($Mailbox.Name):\$($Calendar[0].Name)" -AccessRights LimitedDetails -User Default; foreach ($User in $Mailboxes){if($User -ne $Mailbox){Add-MailboxFolderPermission -identity "$($Mailbox.Name):\$($Calendar[0].Name)" -AccessRights Editor -User $($User.Name)}}}
@wgroenewold
Copy link
Author

Updated to support Outlook for Mac who is a bit crude on the rights management.

@wgroenewold
Copy link
Author

New-DistributionGroup Rooms -RoomList -Members $Members
Add-DistributionGroupMember Rooms -Member room@domain.tld

will enable rooms in scheduling assistant in Outlook for Mac

@wgroenewold
Copy link
Author

Updated to mitigate unassigned object

@wgroenewold
Copy link
Author

Added some error handling, fallbacks and inline credentials

@wgroenewold
Copy link
Author

Oneliners ftw!

@wgroenewold
Copy link
Author

wgroenewold commented Jan 14, 2021

@wgroenewold
Copy link
Author

Edited auth to new spec requirements, thanks @theemstra

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment