Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mardahl/e9ac56f1802e91614a87e6c6c1064515 to your computer and use it in GitHub Desktop.
Save mardahl/e9ac56f1802e91614a87e6c6c1064515 to your computer and use it in GitHub Desktop.
Set Office 365 Room Mailbox Calendar permissions and processing defaults, so subject and meeting organizer is visible.
#Connect to Office 365 Exchange (wont work if MFA is required.
#Use conditional access or whitelisting to allow the connection without MFA
$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange-ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $Session
#Get list fo All Room type mailboxes
$rooms = Get-MailBox | where {$_.ResourceType -eq "Room"}
#Set permissions and processing defaults on alle Room type mailboxes
foreach ($room in $rooms){
$calName = $room | Get-MailboxFolderStatistics -FolderScope calendar | select-object Name
write-host "Setting requested default permissions on: $($room.Identity):\$($calName.Name)" -ForegroundColor Yellow
Set-MailboxFolderPermission -AccessRights LimitedDetails -Identity "$($room.Identity):\$($calName.Name)" -User default
Set-CalendarProcessing -Identity "$($room.Identity)" -AddOrganizerToSubject $true -DeleteComments $false -DeleteSubject $false
Write-Host "Done" -ForegroundColor Green
Write-Host
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment