vendredi 8 avril 2011

How to centrally set the calendar access rights in Exchange 2010

If you want set default user permission to "Reviewer" for your entire organization, here it is a powershell script (replace italic word by your own configuration):

if (-not (Get-PSSnapin | Where-Object {$_.Name -like "Microsoft.Exchange.Management.PowerShell.E2010"})){
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010

$mailboxes = Get-Mailbox -Database "Mailbox Database"
$AccessRights = "Reviewer"

#Loop through all mailboxes
foreach ($mailbox in $mailboxes) {

#Retrieve name of the user`s calendar
$calendar = (($mailbox.SamAccountName)+ ":\" + (Get-MailboxFolderStatistics -Identity $mailbox.SamAccountName -FolderScope Calendar | Select-Object -First 1).Name)

#Check if calendar-permission for user "Default" is set to the default permission of "AvailabilityOnly"
if (((Get-MailboxFolderPermission $calendar | Where-Object {$_.User -like "Default"}).AccessRights) -like "AvailabilityOnly" ) {

Write-Host "Updating calendar permission for $mailbox...$calendar" -ForegroundColor Yellow

#Set calendar-permission for user "Default" to value defined in variable $AccessRights
Set-MailboxFolderPermission -User "Default" -AccessRights $AccessRights -Identity $calendar


PS: You need SP1 to do that

Aucun commentaire:

Enregistrer un commentaire