Avatar of Jordan Howard
Jordan Howard
 asked on

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.
PowershellExchangeMicrosoft Development

Avatar of undefined
Last Comment
Jordan Howard

8/22/2022 - Mon
Will Szymkowski

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.
SubSun

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

Will Szymkowski

On line 3 in my code it should be Get-MailboxFolderPermission (not Get-MailboxFolderPermissions)

Will.
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
Jordan Howard

ASKER
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?
Will Szymkowski

To correct that you can pipe it to "| out-string " before the export-csv command.

Will.
ASKER CERTIFIED SOLUTION
SubSun

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.
Jordan Howard

ASKER
AWESOME!!!! Thanks Subsun! Will I think I see what you were doing but it was erring out.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.