How to export shared mailbox full access list in Exchange Online

Introduction

This script will export shared mailbox full access list in Exchange Online.

Scenarios

This script is to export shared mailbox full access list in Exchange Online. This list can be csv file or xlsx file.

Script

You can use this script in the following way.

1. Open Windows PowerShell.

2. Type the one command< Script Path> at the Windows PowerShell Console.
For example, type C:\Script\
ExportSharedMailboxAccessList.ps1

Here are some code snippets for your references.

PowerShell
Edit|Remove
$List = Get-MailboxPermission -Identity $SharedBox.Identity
   
       Foreach($Box in $List)
       {
           $FullAccessObject = New-Object PSObject
           if($box.AccessRights -eq "FullAccess")
           {
               $BoxInfo = $null
               $BoxInfo = Get-Recipient -Identity $Box.User -ErrorAction silentlycontinue
               if($Boxinfo -ne $null)
               {
                   $FullAccessObject | Add-Member -membertype NoteProperty -Name "Shared Mailbox" -Value $SharedBox.identity
                   $FullAccessObject | Add-Member -membertype NoteProperty -Name "Full Access Object" -Value $BoxInfo.Alias
                   $FullAccessObject | Add-Member -membertype NoteProperty -Name "Full Access Object Address" -Value $BoxInfo.PrimarySmtpAddress
                   $FullAccessObject | Add-Member -membertype NoteProperty -Name "Full Access Object Type" -Value $BoxInfo.RecipientType
                   $FullAccessList += $FullAccessObject
               }

Examples

Example 1: export a list about the full access permission of shared mailbox and the file will be stored in c:\report and the file name is report.xlsx

The sample is showed below
ExportSharedMailboxAccessList.ps1 - Credential  $Credential -ExportExcel $true -FileSavedPath "C:\report" -FileName "report.xlsx"
Result Screenshot:
 

Example 2: export a list about the full access permission of shared mailbox and the file will be stored in c:\report and the file name is report.csv

The sample is showed below
ExportSharedMailboxAccessList.ps1 - Credential  $Credential -ExportExcel $false -FileSavedPath "C:\report" -FileName "report.csv"
Result Screenshot:
 

 

Prerequisites

Exchange Online
Windows PowerShell 2.0

 

Microsoft All-In-One Script Framework is an automation script sample library for IT Professionals. The key value that All-In-One Script Framework is trying to deliver is Scenario-Focused Script Samples driven by IT Pros' real-world pains and needs. The team is monitoring all TechNet forums, IT Pros' support calls to Microsoft, and script requests submitted to TechNet Script Repository. We collect frequently asked IT scenarios, and create script samples to automate the tasks and save some time for IT Pros. The team of All-In-One Script Framework sincerely hope that these customer-driven automation script samples can help our IT community in this script-centric move.