
<# obtain is the list of folders that we will apply permissions

Get-MailboxFolderStatistics igbina | Where { $_.FolderPath.Contains("/") -eq $true } 
Get-MailboxFolderStatistics igbina | Where { $_.FolderPath.Contains("/") -eq $true } | select FolderPath


ForEach($f in (Get-MailboxFolderStatistics John | Where { $_.FolderPath.Contains("/Clients") -eq $True } ) ) { $fname = "John:" + $f.FolderPath.Replace("/","\"); Add-MailboxFolderPermission $fname -User Jane -AccessRights Reviewer } 


#>


[System.Console]::ForegroundColor = [System.ConsoleColor]::White
 
clear-host
 
Write-Host "The user that is giving the permissions"
 
$MailboxUser = Read-Host 

Write-Host "Who are you giving permission to"
 
$GivingPerto = Read-Host
 
write-host Please choose an option below:
 
write-host
 
write-host '1) Owner    - CreateItems, ReadItems, CreateSubfolders, FolderOwner, FolderContact, FolderVisible, EditOwnedItems, EditAllItems, DeleteOwnedItems, DeleteAllItems'
 
write-host '2) Editor   - CreateItems, ReadItems, FolderVisible, EditOwnedItems, EditAllItems, DeleteOwnedItems, DeleteAllItems'
 
write-host '3) Reviewer - ReadItems, FolderVisible'
 
write-host '4) None     -  FolderVisible'
 
write-host '5) Exit' -ForegroundColor Red
 
write-host
 
$opt = Read-Host "Select an option [1-5]"
 
switch ($opt) {
 
1{
 
ForEach($f in (Get-MailboxFolderStatistics $MailboxUser | Where { $_.FolderPath.Contains("/") -eq $True } ) ) { 

$fname = $MailboxUser + ":" +  $f.FolderPath.Replace("/","\");
 
Add-MailboxFolderPermission $fname -User $GivingPerto -AccessRights Owner 
Set-MailboxFolderPermission $fname -User $GivingPerto -AccessRights Owner}
 
}
 
2{
 
ForEach($f in (Get-MailboxFolderStatistics $MailboxUser | Where { $_.FolderPath.Contains("/") -eq $True } ) ) { 

$fname = $MailboxUser + ":" +  $f.FolderPath.Replace("/","\");
 
Add-MailboxFolderPermission $fname -User $GivingPerto -AccessRights Editor 
Set-MailboxFolderPermission $fname -User $GivingPerto -AccessRights Editor}
 
}
 
3{
 
ForEach($f in (Get-MailboxFolderStatistics $MailboxUser | Where { $_.FolderPath.Contains("/") -eq $True } ) ) { 

$fname = $MailboxUser + ":" +  $f.FolderPath.Replace("/","\");
 
Add-MailboxFolderPermission $fname -User $GivingPerto -AccessRights Reviewer
Set-MailboxFolderPermission $fname -User $GivingPerto -AccessRights Reviewer }
 
}
 
4{
 
ForEach($f in (Get-MailboxFolderStatistics $MailboxUser | Where { $_.FolderPath.Contains("/") -eq $True } ) ) { 

$fname = $MailboxUser + ":" +  $f.FolderPath.Replace("/","\");
 
Add-MailboxFolderPermission $fname -User $GivingPerto -AccessRights None 
Set-MailboxFolderPermission $fname -User $GivingPerto -AccessRights None}
 
}
 
5{
 
}
 
}


# Remove-MailboxFolderPermission $fname -User $GivingPerto -Confirm:$False}



<#



This is what I ended up using. Instead of making the script interactive, I just edit what I need and just paste it into the EMS. Big thanks to the original poster and the comments on here to work this out. 

Hope this helps.

$Name = "SDAB"
$User = "doej"
$AccessRights = "Author"

Foreach($Folder in (Get-MailboxFolderStatistics $Name)) {
 $FolderPath = $Folder.FolderPath.Replace("/","\").Replace([char]63743,"/")
 $MailboxFolder = "$Name`:$FolderPath"
 #Add-MailboxFolderPermission "$MailboxFolder" -User "$user" -AccessRights "$AccessRights"
 get-MailboxFolderPermission "$MailboxFolder" | ft
}



Clayton

21 Feb 2014 1:08 AM


Of course, uncomment Add-MailboxFolderPermission and comment Get-MailboxFolderPermission when the right set of folders has been pulled




Add-MailboxFolderPermission cmdlet in Exchange 2013


Exchange 2010 introduced a new built in cmdlet “Add-MailboxFolderPermission”. This command helps us to assign and Manage Folder level permissions for all folders/calendar of a mailbox in the organization.
 

I have been working with a cloud provider who wants RO access to the “Deleted items folder” for all mailboxes in the company.
 

The Access Rights parameters are as below:
 
•ReadItems:  The user has the right to read items within the specified folder.
 
•CreateItems   The user has the right to create items within the specified folder.
 
•EditOwnedItems   The user has the right to edit the items that the user owns in the specified folder.
 
•DeleteOwnedItems   The user has the right to delete items that the user owns in the specified folder.
 
•EditAllItems   The user has the right to edit all items in the specified folder.
 
•DeleteAllItems   The user has the right to delete all items in the specified folder.
 
•CreateSubfolders   The user has the right to create subfolders in the specified folder.
 
•FolderOwner   The user is the owner of the specified folder. The user has the right to view and move the folder and create subfolders. The user can’t read items, edit items, delete items, or create items.
 
•FolderContact   The user is the contact for the specified public folder.
 
•FolderVisible   The user can view the specified folder, but can’t read or edit items within the specified public folder.
 

The Roles with which we can provide the access rights are as below:
 
•None   FolderVisible
 
•Owner   CreateItems, ReadItems, CreateSubfolders, FolderOwner, FolderContact, FolderVisible, EditOwnedItems, EditAllItems, DeleteOwnedItems, DeleteAllItems
 
•PublishingEditor   CreateItems, ReadItems, CreateSubfolders, FolderVisible, EditOwnedItems, EditAllItems, DeleteOwnedItems, DeleteAllItems
 
•Editor   CreateItems, ReadItems, FolderVisible, EditOwnedItems, EditAllItems, DeleteOwnedItems, DeleteAllItems
 
•PublishingAuthor   CreateItems, ReadItems, CreateSubfolders, FolderVisible, EditOwnedItems, DeleteOwnedItems
 
•Author   CreateItems, ReadItems, FolderVisible, EditOwnedItems, DeleteOwnedItems
 
•NonEditingAuthor   CreateItems, ReadItems, FolderVisible
 
•Reviewer   ReadItems, FolderVisible
 
•Contributor   CreateItems, FolderVisible


#>