Question

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
}
Was it helpful?

Solution

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 }

OTHER TIPS

$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 }

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top