[Script] Get all the folder permissions of a user mailbox in Office 365 or Exchange

Below script returns permissions of all the folder from an Exchange or Office365 Mailbox.

param ($mailbox)

$AllMbxFolders=Get-MailboxFolderStatistics $mailbox | Select Name, ContainerClass,folderid
$FilteredFolders=$AllMbxFolders | ? { ` # Add or remove the filter for folder in the below list.
$_.ContainerClass -eq "IPF.Note" -or `
$_.ContainerClass -like "IPF.Appointment" -and `
$_.Name -notlike "*Clatter*" -and `
$_.Name -notlike "*DR*" -and `
$_.Name -notlike "*Junk*" -and `
$_.Name -notlike "*Sync I*"

foreach ($folder in $FilteredFolders) {Get-MailboxFolderPermission -Identity $($mailbox + ":$($folder.FolderID)") -ea SilentlyContinue}

Save the code to a ".ps1" file and run like below.

Get-MailboxAllFolderPermission.ps1 -Mailbox USERID

Download from GitHub.