Allowing a user access to all calendars in his OU

Hi Everyone.

I have a hosted exchange 2010 environment (Meaning we have many little companies that buy mailboxes from us, and each one has its own OU under the main OU called Hosting.Local)

One of our bigger clients has about 250 mailboxes in his OU, the CEO wants permission to view the calendars of all users in his OU.

I was wondering, is there a way to do it with a script to grant him this access or must I really do it manually for each mailbox?

For example, if the username for teh CEO is Hosting\CEO and the OU for said company is contoso, is it possible?

Hoping for a quick response.
David SankovskySenior SysAdminAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David SankovskySenior SysAdminAuthor Commented:
I've found this PS code

$allmailbox = Get-Mailbox -Resultsize Unlimited

Foreach ($Mailbox in $allmailbox)

{Set-mailboxfolderpermission –identity ($Mailbox.alias+':\calendar’) –user Default –Accessrights AvailabilityOnly}

Open in new window

But it will run on the entire exchange server which isn't good. how can I restrict it to a certain OU
Satya PathakLead Technical ConsultantCommented:
Will SzymkowskiSenior Solution ArchitectCommented:
I have modified your script above to point at a single OU. See below...
$allmailbox = Get-Mailbox -Resultsize Unlimited -OrganizationalUnit "OU=test,DC=hosting,DC=local"

Foreach ($Mailbox in $allmailbox)

{Set-mailboxfolderpermission –identity ($Mailbox.alias+':\calendar’) –user Default –Accessrights AvailabilityOnly}

Open in new window

Change the respective OU path with yours in your environment.

Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

David SankovskySenior SysAdminAuthor Commented:
Hi Will. Thanks for your response.

I edited the script and it currently looks like this:

$allmailbox = Get-Mailbox -Resultsize Unlimited -OrganizationalUnit "OU=S001000415,OU=R0001000119,OU=HOSTING,DC=hosting,DC=local"

Foreach ($Mailbox in $allmailbox)

{Set-mailboxfolderpermission –identity ($Mailbox.alias+':\calendar’) –user –Accessrights publishingeditor}

Open in new window

I now get several types of errors:

The specified mailbox "dana"  isn't unique.
    + CategoryInfo          : NotSpecified: (0:Int32) [Set-MailboxFolderPermission], ManagementObjectAmbiguousException
    + FullyQualifiedErrorId : A7E6CD60,Microsoft.Exchange.Management.StoreTasks.SetMailboxFolderPermission


The operation couldn't be performed because 'debo:\calendar' couldn't be found.
    + CategoryInfo          : NotSpecified: (0:Int32) [Set-MailboxFolderPermission], ManagementObjectNotFoundException
    + FullyQualifiedErrorId : 24C95A94,Microsoft.Exchange.Management.StoreTasks.SetMailboxFolderPermission

And the mailboxes that performaed the command succsfully only display available/busy on the CEO's account instead  of seeing all the details.
Will SzymkowskiSenior Solution ArchitectCommented:
In your original script you have AvailibilityOnly which would be why he can only see free/busy. However I do see that you have added publishing editor rights which should suffice.

1st error
The specified mailbox "dana"  isn't unique.
This means that there is more than one account that is dana which is why it is not unique. Typically i like to use emailaddresses and no aliases.

2nd Error
The operation couldn't be performed because 'debo:\calendar' couldn't be found.
Stating this mailbox calendar cannot be found. I would try and run this command individually outside of the script to see if that works.

Other than that everything looks fine from my perspective.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
David SankovskySenior SysAdminAuthor Commented:
Hi Will and thanks for the feedback - I did midify the script to work with addresses and it worked,
About the people who didn't have calendars, It simply took repeating the command with the Hebrew word for that - some of our mailboxes aren't configured in English.

Script works fine now. Thanks for all teh help :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.