Happy New Year everyone, life is short – let’s dream big and make the most of 2022!. In the year’s first article, I want to show you how to create shared mailboxes in Microsoft Exchange online and perform the most common administrative tasks using Powershell.

Important: To perform the tasks described below, your user must be a Global admin or belong to the Exchange admin group.

PowerShell Workaround

First, you need to ensure the ExchangeOnlineManagement module is installed on your computer and then import it into your Powershell session. To do that, you should use the following commands.

Once you have imported the module, you are ready to start.

Connect to Exchange Online

The easiest way to get started is to log in interactively at the command line.

Set the variables

Here we define the basic information of the shared mailbox that we want to create/manage. You should replace <E-MAIL> with the mail you want to assign to the shared mailbox.

Create the shared mailbox

I’ll start by creating the shared mailbox; I will use the New-Mailbox cmdlet with the following syntax.

Shared Mailboxes

Manage mailbox permissions

After the mailbox is created, you need to give users permission to use the shared mailbox. Remember that only people within your organization can use a shared mailbox. You should use the Add-MailboxPermission cmdlet with the following syntax to add permissions to the shared mailbox.

If you want To retrieve permissions on a mailbox, use the Get-MailboxPermission cmdlet with the following syntax.
In case you want to remove a user’s permissions on the shared mailbox, you should use the Remove-MailboxPermission cmdlet with the following syntax.

 Manage “Send as” permission

SendAs permission allows a user or group members to send messages that appear to come from the specified mailbox. To add SendAs permission to users, you should use the Add-RecipientPermission cmdlet with the following syntax.

To list the users who have SendAs permission on the shared mailbox, use the Get-RecipientPermission cmdlet.

If you want to remove SendAs permission from a user or group, use the Remove-RecipientPermission cmdlet with the following syntax.

Configure the shared mailbox

This section will show you how to carry out shared mailboxes’ most common administration tasks. To perform the following tasks, you should use the Set-Mailbox cmdlet.

Send on behalf of permissions

The GrantSendOnBehalfTo parameter specifies who can send on behalf of this mailbox.

To confirm that the user has been successfully added, you should use the following command:
if you want to remove users to Send on Behalf permissions for the shared mailbox. Remove= list if a comma-separated list. Each email address should be in double-quoted brackets.

Shared mailbox email forwarding

The ForwardingSmtpAddress parameter specifies a forwarding SMTP address for messages that are sent to this mailbox.

The DeliverToMailboxAndForward parameter determines how messages are delivered and forwarded.
 $true: Messages are sent to this mailbox and forwarded to the specified email address.
 $false:  Messages are only forwarded to the specified email address. Messages are not delivered to this mailbox.

To get the address listing for email forwarding, use the following cmdlet.

If you want to disable Email Forwarding settings, you should use the following cmdlet.

Manage sent items

Copy items sent as this mailbox, or on behalf of this mailbox, to the mailbox’s Sent Items folder. This lets shared mailbox members see the email other members have sent. If you don’t copy sent items to the mailbox, they will only be saved to the sender’s Sent Items folder. You should use the MessageCopyForSendOnBehalfEnabled and MessageCopyForSentAsEnabled parameters to set the desired settings.

To get the existing sent item settings, use the following cmdlet.
Use the following cmdlet if you want to disable the “Copy items sent as this mailbox ” or “ Copy items sent on behalf of this mailbox ” options.

Manage automatic replies

To enable auto-reply messages (Out of Office), you should use the Set-MailboxAutoReplyConfiguration cmdlet with the following syntax.

To get the existing auto-reply settings, you should use the Get-MailboxAutoReplyConfiguration cmdlet.

If you want to disable auto-reply messages, use the following cmdlet.

Manage email apps

You should use the Set-CASMailbox cmdlet to configure client access settings on a mailbox. Using this cmdlet, you can configure settings for Exchange ActiveSync, Outlook, Outlook on the web (OWA), POP3, and IMAP4.

To get the existing mail apps access settings, use the following cmdlet.

For example, to disable the POP3 access for the shared mailbox, I should use the following cmdlet.

Manage global address list visibility

To get the visibility of the shared mailbox in the address lists, use the following command.

To make the shared mailbox visible in address lists, use the value $false for the HiddenFromAddressListsEnabled parameter.

Thanks for reading my post. I hope you find it helpful.

If you want to learn more About shared mailboxes, check out this link.