Link to home
Start Free TrialLog in
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.
Avatar of Will Szymkowski
Will Szymkowski
Flag of Canada image

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

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

Will.
Avatar of Jordan Howard
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?
To correct that you can pipe it to "| out-string " before the export-csv command.

Will.
ASKER CERTIFIED SOLUTION
Avatar of SubSun
SubSun
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
AWESOME!!!! Thanks Subsun! Will I think I see what you were doing but it was erring out.