Вопрос

I have found the following script and modified it slightly to set the default Calendar permissions for the users but not the resource mailboxes. It looks like it will run correctly, but could you take a look and see if you see any glaring issues with it?

$mailboxes = Get-Mailbox | where {$_.ResourceType -ne "Room"}

$mailboxes | foreach {
    $user=$_.Alias
    $path=$user+”:\Calendar”
    Set-MailboxFolderPermission –Identity $path -User Default -AccessRights Reviewer
}
Это было полезно?

Решение

Looks OK to me (not tested). I would add the ResultSize parameter to bypass the 1000 objects limitation. Looks like you can shorten it a bit. Try this on a test user before you run on all mailbox objects.

$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-Object { Set-MailboxFolderPermission $":\Calendar" -User Default -Accessrights Reviewer }

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top