使用powershell脚本设置Exchange 2010日历权限



我找到了以下脚本,并对其进行了轻微修改,为用户而不是资源邮箱设置了默认的日历权限。看起来它会正确运行,但你能看看它是否有任何明显的问题吗?

$mailboxes = Get-Mailbox | where {$_.ResourceType -ne "Room"}
$mailboxes | foreach {
    $user=$_.Alias
    $path=$user+”:Calendar”
    Set-MailboxFolderPermission –Identity $path -User Default -AccessRights Reviewer
}

我觉得还可以(未测试)。我会添加ResultSize参数来绕过1000个对象的限制。看起来你可以把它缩短一点。在所有邮箱对象上运行之前,请在测试用户上尝试此操作。

$mailboxes = Get-Mailbox -ResultSize Unlimited | Where-Object {$_.ResourceType -ne 'Room'}
$mailboxes | Foreach-Object { Set-MailboxFolderPermission –Identity ($_":Calendar") -User Default -Accessrights Reviewer }
$mailboxes = Get-Mailbox -ResultSize Unlimited | Where-Object {$_.ResourceType -ne 'Room'}
$mailboxes | Foreach-Object { Set-MailboxFolderPermission –Identity ($_.Alias+":Calendar") -User Default -Accessrights Reviewer }

$mailboxes=Get-Mailbox-ResultSize Unlimited|Where Object{$.ResourceType-ne'Room'}$mailboxes|Foreach对象{Set MailboxFolderPermission$":\Calendar"-用户默认值-访问权限审阅者}

最新更新