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

使用powershell脚本设置Exchange 2010日历权限,powershell,permissions,calendar,exchange-server-2010,Powershell,Permissions,Calendar,Exchange Server 2010,我找到了以下脚本,并对其进行了轻微修改,以设置用户的默认日历权限,而不是资源邮箱。看起来它会正常运行,但是你能看看它有没有什么突出的问题吗 $mailboxes = Get-Mailbox | where {$_.ResourceType -ne "Room"} $mailboxes | foreach { $user=$_.Alias $path=$user+”:\Calendar” Set-MailboxFolderPermission –Identity $pat

我找到了以下脚本,并对其进行了轻微修改,以设置用户的默认日历权限,而不是资源邮箱。看起来它会正常运行,但是你能看看它有没有什么突出的问题吗

$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=获取邮箱-ResultSize Unlimited |其中对象{$.ResourceType-ne'Room'}
$mailboxes | Foreach对象{Set-MailboxFolderPermission$“:\Calendar”-用户默认值-Accessrights Reviewer}

您好,谢谢您的帮助。我对您的脚本做了一点小小的更改,我将($\日历)替换为($\别名+“:\日历”)。另一种方法似乎在测试中遇到了空格问题。这看起来像是原始海报代码的改进版本,但它没有回答问题。
$mailboxes = Get-Mailbox -ResultSize Unlimited | Where-Object {$_.ResourceType -ne 'Room'}
$mailboxes | Foreach-Object { Set-MailboxFolderPermission –Identity ($_.Alias+":\Calendar") -User Default -Accessrights Reviewer }