New Post has been published on o365info.com
New Post has been published on http://o365info.com/shared-mailbox-powershell-commands/
Shared Mailbox - PowerShell commands reference
Shared Mailbox, as the name implies, serve for storing “shared data” that we want to share between organization users.
(Shared Mailbox could be used as an alternative solution for Public Folder).
Before we begin, few facts about Shared Mailbox:
Shared Mailbox is a special Mailbox, that doesn’t require a license. The only limitation is that if we want to use the option of “no license” for the Shared Mailbox, the maximum mailbox size should be: 10 GB.
There is no limitation for a number of Shared Mailboxes that can be created.
We cannot configure Outlook profile for the shared Mailbox (Because by default, Shared Mailbox doesn’t have a license). The way that we use for accessing the Shared Mailbox is: by adding the Shared Mailbox as “Additional Mailbox” to the User Outlook profile, or by using OWA to open “other user Mailboxes.” (To enable users to add the Shared Mailbox to Outlook Profile, we will need to assign “Full access” permissions to the User or to the Group)
The PowerShell commands that we use for assigning permission to the Shared Mailbox could be implemented for a “User object” or for a “Group object” (the PowerShell command is identical for assigning permission to a user of for a group).
We cannot assign permission to “Standard distribution group.” To be able to assign permissions to Group, we will need to configure the Distribution group also as a “Security Group.”
1 – Create Shared Mailbox
2 – Create Security Distribution Group
3 – Assign permissions to Shared Mailbox
4 – Shared Mailbox Settings
5 – Display permissions and Information for Shared Mailbox
8 – Download PowerShell menu script
PowerShell | Help & additional information
In case that you are a novice in the PowerShell environment, you can use the following link to get more information about the “first steps” such as: downloading the required PowerShell
software components, how to use the PowerShell console, running a PowerShell script, etc.
PowerShell Naming Conventions & general information
If you want to get more information about the Naming Conventions that we use for this article and get some general tips about: how to work with the PowerShell, read the article: Help and additional information – o365info.com PowerShell articles
Create remote PowerShell session
Before we can use the required PowerShell commands, we need to download and install the Office 365 cmdlets + create remote PowerShell session to Office 365 or Exchange Online. If you need more information about how to create a remote PowerShell session read the following articles: Part 2: Connect to Office 365 by using Remote PowerShell and Part 3: Connect to Exchange Online by using Remote PowerShell
How to use a PowerShell script
Most of the PowerShell articles include a PowerShell script that simplifies the use of the PowerShell commands. If you want to get more information about: How to use a PowerShell script, read the article: Connect to Office 365 and Exchange Online using a script
PowerShell command and Script languish in more details
If you are new to the PowerShell world, you can read more information about PowerShell in Office 365 environment in the article: The Power of PowerShell
Expand All Headers Collapse All Headers
In our scenario, the Shared Mailbox name is: “Public MB”. We will assign the different permission to a security distribution group named: “Office users” that include office 365 users. The Process of creating Shared Mailbox is based on the following steps:
Create the Shared Mailbox
Assign a maximum size of 10 GB to the Shared Mailbox (for avoiding the need of assigning a license to the Shared Mailbox).
Set Distribution group as a “Security Group” – we cannot assign permissions to the standard Distribution group.
Assign permission for the users or the group that will need access to the Shared Mailbox. To enable users to access the Shared Mailbox to their mail profile, we will need to assign “Full Access” permission. To enable users to send email using the “Shared mailbox Alias”, we need to assign “Send As” permission to these users.
1 - Create Shared Mailbox
Create new Shared Mailbox
PowerShell command Syntax
New-Mailbox -Name <Name> –Shared
PowerShell command Example
New-Mailbox -Name "Public MB" -Shared
Adjustments & Customizations | Set Display name, Alias name and Email Address for the Shared Mailbox
New-Mailbox -Name "Public MB" -Alias PB –Shared -PrimarySmtpAddress [email protected]
2 - Create Security Distribution group
Create new Security Distribution Group
PowerShell command Syntax
New-DistributionGroup -Name <Group Name> -Type Security
PowerShell command Example
New-DistributionGroup -Name "Office Users" -Type Security
Adjustments & Customizations | Set Email Address for the Distribution Group.
New-DistributionGroup -Name "Office Users" -Type Security -PrimarySmtpAddress [email protected]
3 - Assign permissions to Shared Mailbox
Assign Full Access permissions for Shared Mailbox
PowerShell command Syntax
Add-MailboxPermission -User <Identity> -AccessRights FullAccess -InheritanceType All
PowerShell command Example
Add-MailboxPermission "Public MB" -User "Office Users" -AccessRights FullAccess -InheritanceType All
Assign Send As permissions for Shared Mailbox
PowerShell command Syntax
Add-RecipientPermission -Trustee <Identity> -AccessRights SendAs
PowerShell command Example
Add-RecipientPermission "Public MB" -Trustee "Office Users" -AccessRights SendAs
Adjustments & Customizations | Disable the need for conformation.
Add-RecipientPermission "Public MB" -Trustee "Office Users" -AccessRights SendAs -confirm:$False
Assign Full Access & Send As permissions for Shared Mailbox + AutoMAP
When we assign to a User “Full Access” permission to another user Mailbox (Such as Shared Mailbox in our example),
The Mailbox is automatically added to the user’s Outlook mail profile. This feature described as: AutoMap.
When we assign “Full Access” permission to a Group, the AutoMap feature is not “activated,” because the permission is granted to “Group Object” and not for a “User object.” In this case, we will need to instruct each of the group members how to add manually the “additional Mailbox”
for which they have “Full access” permission. To avoid this default, we can use a “Little trick”, by using a PowerShell command that “extract” group members to a “user list” and in the next, step assigns the Full Access permission separately, for each user (each of the Group members).
PowerShell command Syntax
$DL = Get-DistributionGroupMember <Group Name> | Select-Object -ExpandProperty Name ForEach ($Member in $DL) Add-MailboxPermission -Identity <Identity> -User $Member -AccessRights ‘FullAccess’ -InheritanceType All
PowerShell command Example
$DL = Get-DistributionGroupMember "Office Users" | Select-Object -ExpandProperty Name ForEach ($Member in $DL) Add-MailboxPermission -Identity "Public MB" -User $Member -AccessRights ‘FullAccess’ -InheritanceType All
Assign “ReadItems” Access permissions to the Shared Mailbox Calendar
PowerShell command Syntax
Add-MailboxFolderPermission –Identity <User:\Calendar> -AccessRight ReadItems -User <User\Group Name>
PowerShell command Example
Add-MailboxFolderPermission –Identity "Public MB:\Calendar" -AccessRight ReadItems –User "Office Users"
>4 - Shared Mailbox Settings
Set Shared mailbox size to 10 GB
PowerShell command Syntax
Set-Mailbox <Identity> -ProhibitSendReceiveQuota 10GB -ProhibitSendQuota 9.75GB -IssueWarningQuota 9.5GB
PowerShell command Example
Set-Mailbox "Public MB" -ProhibitSendReceiveQuota 10GB -ProhibitSendQuota 9.75GB -IssueWarningQuota 9.5GB
5 - Display permissions and Information for Shared Mailbox
Display Full Access permissions for Shared Mailbox
PowerShell command Syntax
Get-MailboxPermission <Identity>
PowerShell command Example
Get-MailboxPermission "Public MB"
Adjustments & Customizations | Remove System object + Self Permission from the output.
Get-MailboxPermission "Public MB" | Where ($_.IsInherited -eq $False) -and -not ($_.User -like “NT AUTHORITY\SELF”) |Select Identity,User,AccessRights
Display Send As permissions for Shared Mailbox
PowerShell command Syntax
Get-RecipientPermission <Identity>
PowerShell command Example
Get-RecipientPermission "Public MB"
Adjustments & Customizations | Remove System object + Self Permission from the output.
Get-RecipientPermission "Public MB" | Where ($_.IsInherited -eq $False) -and -not ($_.Trustee -like “NT AUTHORITY\SELF”) | Select Trustee,AccessControlType,AccessRights
Display all of the existing Shared Mailboxes
PowerShell command Syntax
Get-Mailbox <Identity> -RecipientTypeDetails SharedMailbox
Adjustments & Customizations | Remove unnecessary fields from the output.
Get-Mailbox <Identity> -RecipientTypeDetails SharedMailbox | Select Alias
Revoke Full Access permissions for Shared Mailbox
PowerShell command Syntax
Remove-MailboxPermission <Identity> -User <Identity> -AccessRights FullAccess
PowerShell command Example
Remove-MailboxPermission "Public MB" -User "Office Users" -AccessRights FullAccess
Adjustments & Customizations | Disable the need for conformation.
Remove-MailboxPermission "Public MB" -User "Office Users" -AccessRights FullAccess -Confirm:$False
Revoke Send As permissions for Shared Mailbox
PowerShell command Syntax
Remove-RecipientPermission <Identity> -AccessRights SendAs -Trustee <Identity>
PowerShell command Example
Remove-RecipientPermission "Public MB" -AccessRights SendAs -Trustee "Office Users"
Adjustments & Customizations: Disable the need for conformation.
Remove-MailboxPermission "Public MB" -User "Office Users" -AccessRights FullAccess -Confirm:$False
Convert Regular mailbox to Shared Mailbox
PowerShell command Syntax
Set-Mailbox <Identity> –Type shared
PowerShell command Example
Set-Mailbox "John" –Type shared
Convert Shared Mailbox to Regular Mailbox
PowerShell command Syntax
Set-Mailbox <Identity> –Type Regular
PowerShell command Example
Set-Mailbox "Public MB" -Type Regular
For your convenience, I have “Wrapped” all of the PowerShell commands that was reviewed, In a PowerShell Script named: Shared-Mailbox.ps1
Watch the Video: Shared Mailbox Office 365 (Part 1 + Part 2 )
Using Shared Mailboxes with Office 365
Now it’s Your Turn!
We really want to know what you think about the article