Update Exchange Online Calendar with PowerShell

08.11.16 06:00 PM Comment(s) By Jordan

A request came through to the Umlindi Helpdesk to enable all user calendars to be visible for the rest of the company. Straight-forward? Not exactly.  I first created a policy on exchange online via Office 365 Portal, but this was apparently incorrect. Next step was chatting to Microsoft, who explained that this must be done via PowerShell PS.

Onto the commands. Open PowerShell using administrator option.

***Set-ExecutionPolicy RemoteSigned
***

***$UserCredential = Get-Credential
***

***$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
***

***Import-PSSession $Session
***

Run either of these commands, first one is for individual mailboxes, bottom one is for all user mailboxes.

***Get-MailboxFolderPermission :calendar | Set-MailboxFolderPermission -AccessRights LimitedDetails -User Default *
**

**OR
**

***foreach ($user in Get-Mailbox -RecipientTypeDetails UserMailbox) {
***

***$cal = $user.alias+”:Calendar”
***

***Set-MailboxFolderPermission -Identity $cal -User Default -AccessRights LimitedDetails
***

***}
***

Wait for it to complete, and then:

***Remove-PSSession $Session
***

*Be sure to disconnect the remote PowerShell session when you’re finished. If you close the Windows PowerShell window without disconnecting the session, you could use up all the remote PowerShell sessions available to you, and you’ll need to wait for the sessions to expire. To disconnect the remote PowerShell session, run the following command.

by John Torrance

Jordan

Share -