Script Repository


Allow everyone view user's calendar

March 30, 2017
1314

The following script adds permissions so that everyone could view a user's calendar in Outlook.

Parameter:

  • $exchangeServer - specifies the fully qualified domain name of your Exchange Server.
Edit Remove
PowerShell
$exchangeServer = "exchangeServer.domain.com" # TODO: modify me

try
{
    # Create a remote PowerShell session to the Exchange Server
    $session = New-PSSession -configurationname Microsoft.Exchange -connectionURI http://$exchangeServer/PowerShell
    Import-PSSession $session -DisableNameChecking -AllowClobber
    
    # Get calendar folder name
    $calendarFolderName = (Get-MailboxFolderStatistics "%mail%" | where-object {$_.FolderType -eq "Calendar"}).Name
     
    # Set Mailbox Permissions
    try
    {
        Set-MailboxFolderPermission -Identity "%mail%:\$calendarFolderName" -User Default -AccessRights Reviewer -ErrorAction Stop
    }
    catch
    {
        $context.LogMessage("Could not set Calendar permissions for %username%'s mailbox. Error: " + $_.Exception.Message, "Error")
        return
    }
}
finally
{
    # Close the remote session and release resources
    Remove-PSSession $session
}

Comments ( 0 )
No results found.
Leave a comment