0

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
}
Adi Inbar
  • 12,097
  • 13
  • 56
  • 69
user2060594
  • 3
  • 1
  • 2

3 Answers3

0

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 }
Shay Levy
  • 121,444
  • 32
  • 184
  • 206
  • Hi thanks for the help Shay. I have made a slight change to your script, I replaced ($_":\Calendar") with ($_.Alias+":\Calendar"). The other way seemed to trip up on spaces in testing. – user2060594 Feb 12 '13 at 01:41
0
$mailboxes = Get-Mailbox -ResultSize Unlimited | Where-Object {$_.ResourceType -ne 'Room'}
$mailboxes | Foreach-Object { Set-MailboxFolderPermission –Identity ($_.Alias+":\Calendar") -User Default -Accessrights Reviewer }
Aaron D
  • 5,817
  • 1
  • 36
  • 51
  • This looks like an improved version of the original poster's code but it doesn't answer the question. – Aaron D Jun 18 '13 at 19:00
0

$mailboxes = Get-Mailbox -ResultSize Unlimited | Where-Object {$.ResourceType -ne 'Room'} $mailboxes | Foreach-Object { Set-MailboxFolderPermission $":\Calendar" -User Default -Accessrights Reviewer }