Share via


Exchange: Using PowerShell to find out the user permission to all Mailboxes

Goal : How many Mailboxes in Exchange a user has permission to.

Execute the below command in the PowerShell connected to Exchange. For On-Premises Exchange Server execute the below command in Exchange Management Shell and for Exchange Online execute it in the PowerShell connected to Exchange online. Instructions to connect to Exchange Online are mentioned in my previous article.

Get-Mailbox -ResultSize Unlimited | Get-MailboxPermission | Where-Object {$_.User -eq "user@domain.com"} | Select-Object User,Identity,AccessRights

Example...

Get-Mailbox -ResultSize Unlimited | Get-MailboxPermission | Where-Object {$_.User -eq "vipin@vipingautam.onmicrosoft.com"} | Select-Object User,Identity,AccessRights

To get this data in CSV file execute the below command.

Example...

Get-Mailbox -ResultSize Unlimited | Get-MailboxPermission | Where-Object {$_.User -eq "user@domain.com"} | Select-Object User,Identity,AccessRights | Export-Csv C:\UserPermission.csv -Encoding ascii –NoTypeInformation

Get-Mailbox -ResultSize Unlimited | Get-MailboxPermission | Where-Object {$_.User -eq "vipin@vipingautam.onmicrosoft.com"} | Select-Object User,Identity,AccessRights | Export-Csv C:\UserPermission.csv -Encoding ascii –NoTypeInformation