# encoding: ascii
# api: powershell
# title: MailboxFolderPermissions
# description: Enumerates mailbox folder permissions for all folders in all mailboxes
# version: 0.1
# author: themoblin
# license: CC0
# x-poshcode-id: 4678
# x-archived: 2015-07-02T03:25:22
# x-published: 2015-12-09T15:37:00
#
#
$mailboxes = get-mailbox
$mailboxes| foreach-object {
$alias = $_.alias
$folders = get-mailboxfolderstatistics $_
$foldernames = $folders|select-object name
"--------------------------------------------------------------" | Out-File C:\MailboxPermissions.txt -append
"" | Out-File C:\MailboxPermissions.txt -append
"Processing permissions on $alias" | Out-File C:\MailboxPermissions.txt -append
"" | Out-File C:\MailboxPermissions.txt -append
$foldernames | foreach-object {
$concat = $alias + ":\" + $_.name
get-mailboxfolderpermission -identity $concat -erroraction silentlycontinue | ft foldername,User,AccessRights | Out-File C:\MailboxPermissions.txt -append
}
"" | Out-File C:\MailboxPermissions.txt -append
"--------------------------------------------------------------" | Out-File C:\MailboxPermissions.txt -append
}