Skip to content

Instantly share code, notes, and snippets.

@michevnew
Created August 8, 2020 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michevnew/ddc527abcbf8ab13ff176b2532ecdc25 to your computer and use it in GitHub Desktop.
Save michevnew/ddc527abcbf8ab13ff176b2532ecdc25 to your computer and use it in GitHub Desktop.
Add folder level permissions on all folders in a given mailbox
$mailbox = "shared@domain.com"
$folders = Get-MailboxFolderStatistics $mailbox | ? {$_.FolderType -ne “Root” -and $_.FolderType -ne “Recoverableitemsroot” -and $_.FolderType -ne “Audits” -and $_.FolderType -ne “CalendarLogging” -and $_.FolderType -ne “RecoverableItemsDeletions” -and $_.FolderType -ne “RecoverableItemspurges” -and $_.FolderType -ne “RecoverableItemsversions”}
Add-MailboxFolderPermission $mailbox -User user@domain.com -AccessRights Reviewer #root permissions
foreach ($folder in $folders) {
$FolderPath = $folder.FolderPath.Replace("/","\").Replace([char]63743,"/") #with PowerShell v3 'fix'
$MailboxFolder = "$mailbox`:$FolderPath"
Add-MailboxFolderPermission "$MailboxFolder" -User user@domain.com -AccessRights Reviewer
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment