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
oke thanks you about your information this is great !
LikeLike