How to check Shared mailbox’s Access Rights via Powershell

Very brief guide on how to check the permissions via Powershell for each and every shared mailbox in your organisation.

You will need to need to connect to your tenant via Powershell. You can do this by following the Microsoft documentation here: https://docs.microsoft.com/en-us/powershell/exchange/connect-to-exchange-online-powershell?view=exchange-ps or by doing the following.

  1. Run Powershell (preferably as admin)

  2. Run Set-ExecutionPolicy RemoteSigned although running that does’t help connect you to Exchange online, it is worth running it now to help your script run later.

  3. Run $UserCredential = Get-Credential

  4. Run $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

  5. Run Import-PSSession $Session -DisableNameChecking

and finally, run the following script:

Get-Mailbox -Filter {recipienttypedetails -eq "SharedMailbox"} | Get-Mailboxpermission | Export-CSV "C:\All-SharedMailboxes-Members.csv" -NoTypeInformation -Encoding UTF8

Make sure you run Remove-PSSession $Session when you are done to exit your Powershell session correctly and to ensure you don’t leave sessions open.

Once run, you will need to navigate to the root of C and find the file called ‘All-SharedMailboxes-Members’. You can edit the Powershell script path and save it to a preferred folder.

Previous
Previous

How to connect to your Office 365 Tenant via Powershell

Next
Next

How to check mailbox rules in O365