Exchange - Script to add Calender permssions to everyone from Everyone

HI all

I need to give reviewer permissions to all users. everyone on the Office365 tenet will need reviewer access to everyone calenders
I came up with this crude script, it aint fancy it works half way though but the Add-MailboxFolderPermission gives an error

Any ideas?

$usersmail=Get-Mailbox -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'UserMailbox') -and (Alias -ne 'Admin')}

$UPNList=Get-Mailbox -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'UserMailbox') -and (Alias -ne 'Admin')}  | select UserPrincipalName

$usersmailformatted01= $usersmail -replace '@{Identity='
$usersmailformatted02= $usersmailformatted01 -replace '}'

$UPNListFormatted01= $UPNList -replace '@{UserPrincipalName='
$UPNListFormatted02= $UPNListFormatted01 -replace '}'

Not sure from here onwards

foreach ($usera in $usersmailformatted02){foreach ($userb in $UPNListFormatted02){Add-MailboxFolderPermission -Identity "$user:\Calendar" -User $userb -AccessRights Reviewer}}
Rat ZuluAsked:
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.

Will SzymkowskiSenior Solution ArchitectCommented:
Not sure what you are trying to do exactly in your script but you can accomplish this by using the following script below...

$Mailboxes = Get-Mailbox -ResultSize "unlimited"
ForEach ($Account in $Mailboxes) {
Set-MailboxFolderPermission -Identity ($Account.Alias:\Calendar) -User Default -AccessRights Reviewer

Open in new window


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
Minecraft_ EndermanCommented:
To make all Domain Users able see all appointments between each other. We just need to set the “default” user as Reviewer permission.

Script like this:
$users = Get-mailbox –Resultsize Unlimited
$users | ForEach-Object {Set-MailboxFolderPermission $_":\Calendar" -User Default -AccessRights Reviewer

Open in new window

Will SzymkowskiSenior Solution ArchitectCommented:
Not sure why you would basically repeat what I said in my first post.

Minecraft_ EndermanCommented:
Sorry, I didn't see your script carefully......
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.