Create a CSV of mailbox delegate permissions to a mailbox

Scenario: You want to find who has delegate permissions to a mailbox and export the users, folders, and access permissions to a CSV File.

Run the following:

$AllUsers = get-mailbox  test*

ForEach ($Alias in $AllUsers)
 {
 $Mailbox = “” + $Alias.Name
 Write-Host “Getting folders for mailbox: ” $Mailbox
 $Folders = Get-MailboxFolderStatistics $Mailbox | % {$_.folderpath} | % {$_.replace(“/”,””)}

 $list = ForEach ($F in $Folders)
  {
  $FolderKey = $Mailbox + “:” + $F
  $Permissions = Get-MailboxFolderPermission -identity $FolderKey -ErrorAction SilentlyContinue
  $Permissions | Where-Object {$_.User -notlike “Default” -and $_.User -notlike “Anonymous” -and $_.AccessRights -notlike “None” -and $_.AccessRights -notlike  “Owner” }| Select $Mailbox, User, FolderName, AccessRights, *path*
  }
 }

$list | Export-csv C:delegates.csv

Reference: This code is edited from the original

Advertisement

One thought on “Create a CSV of mailbox delegate permissions to a mailbox”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: