skip to Main Content

Export Office 365 mailbox permissions to CSV

We want to get a list of Office 365 mailbox permissions because we like to know which user has access to which mailbox. The mailbox permissions are full access, send as, and send on behalf. Signing in to the Microsoft 365 admin portal and going through the users one by one to find the mailbox permissions takes a lot of time. An excellent way to export an Office 365 mailbox permissions report is with PowerShell. In this article, we will look at how to export Office 365 mailbox permissions to CSV with PowerShell.

Introduction

The script will go through all the users and shared mailboxes in Microsoft 365/Office 365 and export the mailbox permissions:

  • Full Access
  • Send As
  • Send on Behalf

Do you want to export Exchange on-premises mailbox permissions? Read the article Export mailbox permissions to CSV file.

Connect to Exchange Online

Before we can proceed further and export Office 365 mailbox permissions to CSV, we need to install and connect to Exchange Online PowerShell V2. Start Windows PowerShell as administrator and run the cmdlet Connect-ExhangeOnline.

PS C:\> Connect-ExchangeOnline

Now that we are connected, we can go to the next step.

Prepare Get-MailboxPermissions PowerShell script

Create two folders on the C:\ drive:

  • Temp
  • Scripts

Download the Get-MailboxPermissions.ps1 PowerShell script and place it in C:\scripts folder. The script will export the CSV file to the C:\temp folder.

Export Office 365 mailbox permissions to CSV scripts folder

Run Get-MailboxPermissions PowerShell script

Get Office 365 mailbox permissions with PowerShell. First, change the path to the scripts folder. After that, run the script Get-MailboxPermissions.ps1.

PS C:\> cd c:\scripts\
PS C:\scripts> .\Get-MailboxPermissions.ps1

Open Office 365 mailbox permissions report CSV file

The Get-MailboxPermissions.ps1 PowerShell script will export Office 365 mailbox permissions to CSV file. Find the file MailboxPermissions.csv in the path C:\temp.

Export Office 365 mailbox permissions to CSV temp folder

Open the CSV file with your favorite application. In our example, it’s Microsoft Excel.

Export Office 365 mailbox permissions to CSV file

The Office 365 mailbox permissions report looks excellent.

Out-GridView

Suppose you want to see the report in the grid view window. For example, you like to know how the report looks before you export it to CSV. If so, we can use the Out-GridView cmdlet.

Change line 59 from:

$Report | Sort -Property @{Expression = { $_.MailboxType }; Ascending = $False }, Mailbox | Export-CSV c:\temp\MailboxPermissions.csv -NoTypeInformation -Encoding UTF8

to:

$Report | Sort -Property @{Expression = { $_.MailboxType }; Ascending = $False }, Mailbox | Out-GridView

After changing the above line, let’s run the script to check its appearance in the grid view window.

Export Office 365 mailbox permissions to CSV Out-GridView

The Office 365 mailbox permissions in the out grid view window look great.

Did this help you to export Office 365 mailbox permissions to CSV file?

Read more: Set default calendar permissions for all users with PowerShell »

Conclusion

You learned how to export Office 365 mailbox permissions with PowerShell. Get the Office 365 mailbox permissions report with Get-MailboxPermissions PowerShell script and have a close look through it. After reviewing, adjust the mailbox permissions to your needs.

Did you enjoy this article? You may also like Manage calendar permissions in Office 365 with PowerShell. Don’t forget to follow us and share this article.

ALI TAJRAN

ALI TAJRAN

ALI TAJRAN is a passionate IT Architect, IT Consultant, and Microsoft Certified Trainer. He started Information Technology at a very young age, and his goal is to teach and inspire others. Read more »

This Post Has 0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *