Solved

powershell script to add permission to a shared mailbox

Posted on 2014-10-13
6
251 Views
Last Modified: 2015-02-04
hello,

i have many shared mailbox in exchange 2013, i will use it to replace public folder.

i need to add permission to shared mailbox, full access is simple, but i need script to get every folder on shared mailbox like (inbox, calender....) and add to a group or user the Reviewer right or Contributor.

thanks for help
0
Comment
Question by:cawasaki
6 Comments
 
LVL 31

Expert Comment

by:Gareth Gudger
ID: 40377197
Hi. Just to confirm. So you want different folders in the Shared Mailbox to have different permissions for different users? Not just the blanket Full Access right.
0
 

Author Comment

by:cawasaki
ID: 40377216
i need for exemple to add for all mailbox folder the right Reviewer for group or user.
yes for exemple:
group1 will have full access.
group2 will have just reviewer right (to prevent delet item from mailbox)
0
 
LVL 38

Expert Comment

by:Vasil Michev (MVP)
ID: 40379203
You will need to adjust the permissions on the folder level, as the Add-MailboxPermission cmdlet only allows you for certain level of access (you can use it for ReadPermission, but that only allows opening the mailbox, not expanding the folders, etc). Check for example here:

http://exchangeserverpro.com/grant-read-access-exchange-mailbox/
0
 

Author Comment

by:cawasaki
ID: 40379363
hi Vasil,

i have test this script, and it seems to work but with error:
The operation couldn’t be performed because ‘test.mailbox:\Top of Information Store’ couldn’t be found.
+ CategoryInfo : NotSpecified: (:) [Add-MailboxFolderPermission], ManagementObjectNotFoundException
+ FullyQualifiedErrorId : [Server=mailboxserver1,RequestId=44d1cd48-8a1b-46ae-bcf6-fda199f2be50,TimeStamp=13/10/2014 10
:32:20] [FailureCategory=Cmdlet-ManagementObjectNotFoundException] B52CDE40,Microsoft.Exchange.Management.StoreTas
ks.AddMailboxFolderPermission
+ PSComputerName : mailboxserver1.domain.com

and this error:

The operation couldn’t be performed because ‘test.mailbox:\Calendar Logging’ couldn’t be found.
+ CategoryInfo : NotSpecified: (:) [Add-MailboxFolderPermission], ManagementObjectNotFoundException
+ FullyQualifiedErrorId : [Server=mailboxserver1,RequestId=6097ea46-ae18-402c-b424-3f71cdaeccf9,TimeStamp=13/10/2014 10
:32:32] [FailureCategory=Cmdlet-ManagementObjectNotFoundException] 42945040,Microsoft.Exchange.Management.StoreTas
ks.AddMailboxFolderPermission
+ PSComputerName : mailboxserver1.domain.com

Open in new window


are this normal with exchange 2013??

thanks for help
0
 
LVL 68

Accepted Solution

by:
Qlemo earned 500 total points
ID: 40450382
There is a correction of the script posted down in the discussion. I've simplified that:
[CmdletBinding()]
param (
	[Parameter( Mandatory=$true)]
	[string]$Mailbox,

	[Parameter( Mandatory=$true)]
	[string]$User,

	[Parameter( Mandatory=$true)]
	[string]$Access
)

$exclusions = @("/Sync Issues",
                "/Sync Issues/Conflicts",
                "/Sync Issues/Local Failures",
                "/Sync Issues/Server Failures",
                "/Recoverable Items",
                "/Deletions",
                "/Purges",
                "/Versions"
                )

$mailboxFolderPaths = @(Get-MailboxFolderStatistics $Mailbox | ? { $exclusions -notcontains $_.FolderPath } | Select -Expand FolderPath)

foreach ($mailboxFolderPath in $mailboxFolderPaths)
{
	$folder = $mailboxfolderPath.Replace(“/”,”\”).Replace(“\Top of Information Store”,”\”)
	$identity = “$mailbox`:$folder"
	Write-Host “Adding $user to $identity with $access permissions”
	Add-MailboxFolderPermission -Identity $identity -User $user -AccessRights $Access
}

Open in new window

0
 

Author Comment

by:cawasaki
ID: 40464051
hello,

sorry, i will test now and report
0

Join & Write a Comment

Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now