Manage Office 365 Shared Mailbox with PowerShell, in this article we check how to Manage Office 365 Shared Mailbox with PowerShell.
Shared mailboxes in Microsoft 365 serve as collaborative solutions, allowing multiple users to access and manage a common email account. While the web interface provides basic management capabilities, PowerShell offers advanced functionality for effectively managing shared mailboxes.
This article explores the power of PowerShell in shared mailbox management, including permissions management, calendar access, mailbox conversions, data exports, and granting “Send As” and “Send on Behalf” permissions. Additionally, we will cover bulk permission operations using CSV input, further streamlining the management process.

Table of Contents
Getting Started with PowerShell and Microsoft 365
To Manage Office 365 Shared Mailbox with PowerShell, you need to install the Microsoft 365 PowerShell module, enabling connections to Microsoft 365 services and administrative tasks.
1. Install the Microsoft 365 PowerShell module by running the following commands in a PowerShell console:
Install-Module -Name PowerShellGet -Force -AllowClobber
Install-Module -Name ExchangeOnlineManagement -Force -AllowClobber
2. Connect to Microsoft 365 using the following command:
Connect-ExchangeOnline -Credential (Get-Credential)
Enter your Microsoft 365 admin credentials when prompted.
Manage Office 365 Shared Mailbox with PowerShell
With the PowerShell connection established, let’s explore how to manage Office 365 Shared Mailbox with PowerShell
Creating a Shared Mailbox
To create a shared mailbox, use the following command:
New-Mailbox -Shared -Name "Shared Mailbox Name" -Alias "SharedMailboxAlias" -UserPrincipalName "shared@contoso.com" -DisplayName "Shared Mailbox Display Name" -Password (ConvertTo-SecureString -String "Password123" -AsPlainText -Force)
This command creates a new shared mailbox with the specified properties.
Granting Permissions to Users
To grant permissions to users, use the Add-MailboxPermission command. For example, to grant “JohnDoe” full access to a shared mailbox, run the following command:
Add-MailboxPermission -Identity "shared@contoso.com" -User "JohnDoe" -AccessRights FullAccess
Managing Calendar Permissions
To manage calendar access for shared mailboxes, use the Add-MailboxFolderPermission command. For example, to grant “JohnDoe” reviewer access to the shared mailbox calendar, run the following command:
Add-MailboxFolderPermission -Identity "shared@contoso.com:\Calendar" -User "JohnDoe" -AccessRights Reviewer
Converting to Other Mailbox Types
To convert a shared mailbox to another mailbox type, such as a user mailbox, resource mailbox, or shared mailbox, use the Set-Mailbox command. For example, to convert a shared mailbox to a user mailbox, run the following command:
Set-Mailbox -Identity "shared@contoso.com" -Type Regular
Exporting Mailbox Data
To export mailbox data from a shared mailbox, use the New-MailboxExportRequest command. For example, to export the contents of a shared mailbox to a PST file, run the following command:
New-MailboxExportRequest -Mailbox "shared@contoso.com" -FilePath "\\fileserver\sharedmailbox.pst"
Granting “Send As” Permissions
To grant users the ability to send emails “As” or “On Behalf” of a shared mailbox, use the Add-RecipientPermission command. For example, to grant “JohnDoe” the “Send As” permission for a shared mailbox, run the following command:
Add-RecipientPermission -Identity "shared@contoso.com" -Trustee "JohnDoe" -AccessRights SendAs
Bulk Permission Operations with CSV Input
PowerShell’s bulk operation capabilities significantly streamline managing permissions for multiple shared mailboxes. The following script demonstrates bulk permission management using a CSV file for input:
# Import the CSV file
$permissionsCSV = Import-Csv -Path "C:\Path\to\permissions.csv"
# Iterate through each row in the CSV
foreach ($row in $permissionsCSV) {
$sharedMailbox = $row.SharedMailbox
$user = $row.User
$accessRights = $row.AccessRights
# Grant permissions
Add-MailboxPermission -Identity $sharedMailbox -User $user -AccessRights $accessRights
}
The CSV file should have the following columns: SharedMailbox, User, and AccessRights. Each row represents a permission assignment for a shared mailbox.
Conclusion
PowerShell provides administrators with advanced capabilities for manage Office 365 Shared Mailbox with PowerShell. With its automation features, bulk operations, and fine-grained control, PowerShell streamlines shared mailbox management tasks. By incorporating PowerShell into your Microsoft 365 administration toolkit, you can efficiently create shared mailboxes, manage permissions, calendar access, mailbox conversions, data exports, and grant “Send As” and “Send on Behalf” permissions. Furthermore, leveraging PowerShell’s bulk operation capabilities with CSV input enables seamless management of permissions for multiple shared mailboxes. Embrace the power of PowerShell to optimize shared mailbox management and enhance productivity within your organization.
Visit Latestinfo365.com to check more article