Get MailFolderPermissions

I need to pull what permissions are on each top level (top of information store) folder of each users mailbox. I have tried many different ways and I need some fresh eyes/thoughts - Don't want to cloud anyone elses mind so I just give the basic command for an individual...

Get-MailboxFolderPermission -identity (user's email) | ft -Property User,AccessRights

I need a command/script that will gather this for each user in my organization and also label which mailbox it's from.
Jordan HowardNetwork AdministratorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Will SzymkowskiSenior Solution ArchitectCommented:
Try the below command...
$Mailboxes = Get-Mailbox -ResultSize "unlimited"
ForEach ($Mailbox in $Mailboxes) { 
Get-MailboxFolderPermissions -Identity $Mailbox | ? {$_.FolderName -eq "Top of Information Store"} |
select $Mailbox, User, AccessRights
} 

Open in new window


Will.
0
SubsunCommented:
Try this code..
$mailbox = Get-Mailbox -ResultSize Unlimited
$(Foreach ($Mbx in $mailbox){
 Get-MailboxFolderPermission $Mbx.alias | 
	?{$_.FolderName -eq "Top of Information Store"} |
	Select @{N="MailBox";E={$Mbx.alias}},FolderName,User,AccessRights,Identity
})| Export-Csv C:\MailboxFolderPermission.csv -NoTypeInformation

Open in new window

0
Will SzymkowskiSenior Solution ArchitectCommented:
On line 3 in my code it should be Get-MailboxFolderPermission (not Get-MailboxFolderPermissions)

Will.
0
Introducing the "443 Security Simplified" Podcast

This new podcast puts you inside the minds of leading white-hat hackers and security researchers. Hosts Marc Laliberte and Corey Nachreiner turn complex security concepts into easily understood and actionable insights on the latest cyber security headlines and trends.

Jordan HowardNetwork AdministratorAuthor Commented:
Nice Subsun - But the export to csv never puts the format right for AccessRights. It always shows up as "System.Collections.ObjectModel.Collection`1[Microsoft.Exchange.Management.StoreTasks.MailboxFolderAccessRight]"

Any ideas?
0
Will SzymkowskiSenior Solution ArchitectCommented:
To correct that you can pipe it to "| out-string " before the export-csv command.

Will.
0
SubsunCommented:
It's because AccessRights is a multi valued property.. Change line 5 to
Select @{N="MailBox";E={$Mbx.alias}},FolderName,User,@{N="AccessRights";E={$_.AccessRights}},Identity

Open in new window

Try..
$mailbox = Get-Mailbox -ResultSize Unlimited
$(Foreach ($Mbx in $mailbox){
 Get-MailboxFolderPermission $Mbx.alias | 
	?{$_.FolderName -eq "Top of Information Store"} |
	Select @{N="MailBox";E={$Mbx.alias}},FolderName,User,@{N="AccessRights";E={$_.AccessRights}},Identity
})| Export-Csv C:\MailboxFolderPermission.csv -NoTypeInformation

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jordan HowardNetwork AdministratorAuthor Commented:
AWESOME!!!! Thanks Subsun! Will I think I see what you were doing but it was erring out.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.