Avatar of Jaime Umali
Jaime Umali
Flag for Switzerland asked on

Get MailboxFolderPermission script to CSV - Exchange 2010

Hi guys, I'm creating a report gathering user's mailbox folder delegation i already have the following data:
Mailbox,DelagateUser,Foldername,AccessRights,

what I need as final report is this:
Mailbox,Alias(alias of mailbox),DelegateUser(alias of delegate user),City,Department,FolderName,AccessRights

I need this on a CSV.

Thanks guys for continuous help!!
ExchangeShell ScriptingSBSEmail ServersPowershell

Avatar of undefined
Last Comment
Jaime Umali

8/22/2022 - Mon
Manikandan Narayanswamy

Hi,

Try to use command like this and let me know if you face any issue

Get-Mailbox | Get-MailboxPermission | Where { $.IsInherited -eq $False } | Select Alias,City,Department,FolderName {$.AccessRights},Deny | Export-Csv C:\export.csv

Thanks
Manikandan
Jaime Umali

ASKER
thanks Manikandan,  but rather I need "Get-mailboxFolderPermission"

my script runs like this:
$allfolders = @()

$DB1 = Get-mailbox "mailbox_owner"

ForEach ($Alias in $DB1)
{
$Mailbox = "" + $Alias.DisplayName
Write-Output $Mailbox
$mb = @{Expression={$Alias.DisplayName};Label="Mailbox"}
$Folders = Get-MailboxFolderStatistics $Mailbox | % {$_.folderpath} | % {$_.replace(“/”,”\”)}

ForEach ($F in $Folders)
{
$FolderKey = $Mailbox + ":" + $F
$Permissions = Get-MailboxFolderPermission -identity $FolderKey -ErrorAction SilentlyContinue
$add = $Permissions | Where-Object {$_.User -notlike "Default" -and $_.User -notlike "Anonymous" -and $_.AccessRights -notlike "None" -and $_.AccessRights -notlike "Owner" -and $_.User -NotMatch "NT"}| Select $mb,@{Expression={$_.User};Label="DelegateUser"},FolderName,@{Expression={$_.AccessRights};Label="AccessRights"}
$allfolders += $add

}
}

$allfolders | Where-Object {$_} | Export-Csv "D:\MailboxFolderPermissionData\AllUsers.csv" -NoTypeInformation
ASKER CERTIFIED SOLUTION
Jaime Umali

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Jaime Umali

ASKER
got the report needed
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy