Managing user mailboxes in Microsoft Exchange Server 2016 is a day-to-day task of system engineers. This article focuses on managing user mailboxes in Microsoft Exchange Server 2016 including very common features like creating, removing and disabling the mailboxes with the help of PowerShell.

Importing an Exchange Management Shell

Your first step is to import an Exchange Management Shell before you can start executing Exchange Server’s related PowerShell commands.

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn 1 Add - PSSnapin Microsoft . Exchange . Management . PowerShell . SnapIn

Creating a User Mailbox

Let us start with creating a user mailbox. Following is the complete syntax:

New-Mailbox -Name <Name> -UserPrincipalName <UPN> -Password (ConvertTo-SecureString -String '<Password>' -AsPlainText -Force) [-Alias <Alias>] [-FirstName <FirstName>] [-LastName <LastName>] [-DisplayName <DisplayName>] -[OrganizationalUnit <OU>] 1 New - Mailbox - Name < Name > - UserPrincipalName < UPN > - Password ( ConvertTo - SecureString - String '<Password>' - AsPlainText - Force ) [ - Alias < Alias > ] [ - FirstName < FirstName > ] [ - LastName < LastName > ] [ - DisplayName < DisplayName > ] - [ OrganizationalUnit < OU > ]

Where

-Name specifies the name of the object in an active directory.

-Alias is an optional parameter used to generate primary email address in the format <alias>@<domain>. If you don’t specify an alias in a command, the username part of user principal name is used.

-DisplayName is an optional parameter. If not specified, a value of name parameter is used.

Example

The example below will illustrate how you can create a user mailbox.

New-Mailbox -Name “Karim Buzdar” -UserPrincipalName kbuzdar@yourdomain.com -Password (ConvertTo-SecureString -String ‘@password1' -AsPlainText -Force) -Alias ‘karimbuzdar’ -FirstName karim -LastName buzdar -DisplayName “karim buzdar” -OrganizationalUnit Users 1 New - Mailbox - Name “ Karim Buzdar ” - UserPrincipalName kbuzdar @ yourdomain . com - Password ( ConvertTo - SecureString - String ‘ @ password1 ' - AsPlainText - Force ) - Alias ‘ karimbuzdar ’ - FirstName karim - LastName buzdar - DisplayName “ karim buzdar ” - OrganizationalUnit Users

If you would like to prompt for the password during runtime, slightly change the above command.

New-Mailbox -Name “Karim Buzdar” -UserPrincipalName kbuzdar@yourdomain.com -Password (Read-host “Enter Password” -AsSecureString) -Alias ‘karimbuzdar’ -FirstName karim -LastName buzdar -DisplayName “karim buzdar” -OrganizationalUnit Users 1 New - Mailbox - Name “ Karim Buzdar ” - UserPrincipalName kbuzdar @ yourdomain . com - Password ( Read - host “ Enter Password ” - AsSecureString ) - Alias ‘ karimbuzdar ’ - FirstName karim - LastName buzdar - DisplayName “ karim buzdar ” - OrganizationalUnit Users

You can verify that the mailbox has been created successfully with the help of Get-Mailbox command.

Get-Mailbox -Identity “<Name/DisplayName/Alias/User Principal Name>” 1 Get - Mailbox - Identity “ < Name / DisplayName / Alias / User Principal Name > ”

Disabling a User Mailbox

When you disable the user mailbox, it removes the exchange attribute of user account but leaves it in active directory. After disabling user mailbox, it is retained in exchange mailbox database until a retention period is expired and then it is permanently removed.

You can try disabling the user account with user mailbox name, display name, alias or User Principal Name (UPN).

Disable-Mailbox -Identity "<Name/DisplayName/Alias/User Principal Name>" 1 Disable - Mailbox - Identity "<Name/DisplayName/Alias/User Principal Name>"

Example

For example, you have a user mailbox with the name “karim buzdar” and you want to disable it. You have to execute Disable-Mailbox command and provide mailbox name as an identity parameter.

Disable-Mailbox -Identity "karim buzdar" 1 Disable - Mailbox - Identity "karim buzdar"

StarWind HyperConverged Appliance is a turnkey, entirely software-defined hyperconverged platform purpose-built for intensive virtualization workloads. Bringing the desired performance and reducing downtime, the solution can be deployed by organizations with limited budgets and IT team resources. Also, it requires only one onsite node to deliver HA for your applications that make the solution even more cost-efficient. Find out more about ➡ StarWind HyperConverged Appliance

Enabling a User Mailbox

If a user mailbox has been disabled, you can enable it by using Enable-Mailbox command.

Enable-Mailbox -Identity "<Name/DisplayName/Alias/User Principal Name>" 1 Enable - Mailbox - Identity "<Name/DisplayName/Alias/User Principal Name>"

Example

Take an example of mailbox “karim buzdar” that you have disabled earlier. Let’s enable it again.

Enable-Mailbox -Identity "karim buzdar" 1 Enable - Mailbox - Identity "karim buzdar"

Removing a User Mailbox

When you remove a user mailbox, the account is permanently removed from both Exchange mailbox database and active directory.

You can remove the user mailbox with the help of its name, display name, alias or User Principal Name (UPN). The complete syntax of the command is.

Remove-Mailbox -Identity "<Name/DisplayName/Alias/User Principal Name>" 1 Remove - Mailbox - Identity "<Name/DisplayName/Alias/User Principal Name>"

Changing User Mailbox Password

You can change the password of an existing user mailbox by either using his/her name, display name, alias or user principal name. You should have an old password before you can set his/her new password.

Set-Mailbox -Identity "<Name/DisplayName/Alias/User Principal Name>" -OldPassword (ConvertTo-SecureString -string “<old password>” -AsPlainText -Force) -NewPassword (ConvertTo-SecureString -string “<new password>” -AsPlainText -Force) 1 Set - Mailbox - Identity "<Name/DisplayName/Alias/User Principal Name>" - OldPassword ( ConvertTo - SecureString - string “ < old password > ” - AsPlainText - Force ) - NewPassword ( ConvertTo - SecureString - string “ < new password > ” - AsPlainText - Force )

Example

Suppose, you want to change the password of “karim buzdar”. The user mailbox has an old password of “@pass1” and his new password should become “@pass2”.

Set-Mailbox -Identity "karim buzdar" -OldPassword (ConvertTo-SecureString -string “@pass1” -AsPlainText -Force) -NewPassword (ConvertTo-SecureString -string “@pass2” -AsPlainText -Force) 1 Set - Mailbox - Identity "karim buzdar" - OldPassword ( ConvertTo - SecureString - string “ @ pass1 ” - AsPlainText - Force ) - NewPassword ( ConvertTo - SecureString - string “ @ pass2 ” - AsPlainText - Force )

If you would like the system to prompt you for an old and new password during runtime, after modification the above command should look like.

Set-Mailbox -Identity "karim buzdar" -OldPassword (Read-host “Enter Old Password” -AsSecureString) -NewPassword (Read-host “Enter New Password” -AsSecureString) 1 Set - Mailbox - Identity "karim buzdar" - OldPassword ( Read - host “ Enter Old Password ” - AsSecureString ) - NewPassword ( Read - host “ Enter New Password ” - AsSecureString )

Changing User Mailbox Department and Title

In rare situations, you may need to change user’s department and title. Use the following command when you need are required.

Set-User -Identity “<Name/DisplayName/Alias/User Principal Name>” -Department “<Name of Department>” -Title “<Designation or Title>” 1 Set - User - Identity “ < Name / DisplayName / Alias / User Principal Name > ” - Department “ < Name of Department > ” - Title “ < Designation or Title > ”

Example

Again, take an example of user “Karim Buzdar” and change or set his department or title.

Set-User -Identity “karim buzdar” -Department “IT” -Title “IT Officer” 1 Set - User - Identity “ karim buzdar ” - Department “ IT ” - Title “ IT Officer ”

Configuring Storage Quotas for a User Mailbox

Storage quota allows you to control the size of mailboxes. Following are the storage quota settings:

Issue a warning at (GB) – When a mailbox size reaches or exceeds this value, Exchange sends a warning message to the user.

Prohibit send at (GB) – When a mailbox size reaches or exceeds this value, Exchange prevents the user from sending new email messages and displays a descriptive error message.

Prohibit send and receive at (GB) – When a mailbox reaches or exceeds this value, Exchange prevents the user from sending and receiving new email messages. The email messages are returned to the user with a descriptive error message.

Below is the syntax of the complete command.

Set-Mailbox -Identity "<Name/DisplayName/Alias/User Principal Name>” -IssueWarningQuota 24.5gb -ProhibitSendQuota 24.75gb -ProhibitSendReceiveQuota 25gb -UseDatabaseQuotaDefaults $false 1 Set - Mailbox - Identity " < Name / DisplayName / Alias / User Principal Name > ” - IssueWarningQuota 24.5gb - ProhibitSendQuota 24.75gb - ProhibitSendReceiveQuota 25gb - UseDatabaseQuotaDefaults $ false

Setting the UseDatabaseQuotaDefaults to false ensures that the custom settings for the mailbox are used rather than default settings.

Example

The following example sets the issue warning, prohibit send, and prohibit send and receive quotas for “karim buzdar” mailbox to 24.5gb, 24.5gb, and 25gb respectively.

Set-Mailbox -Identity "karim buzdar" -IssueWarningQuota <value in GB suppose 24.5gb> -ProhibitSendQuota <value in GB suppose 24.75gb> -ProhibitSendReceiveQuota <value in GB suppose 25gb> -UseDatabaseQuotaDefaults $false 1 Set - Mailbox - Identity "karim buzdar" - IssueWarningQuota < value in GB suppose 24.5gb > - ProhibitSendQuota < value in GB suppose 24.75gb > - ProhibitSendReceiveQuota < value in GB suppose 25gb > - UseDatabaseQuotaDefaults $ false

Conclusion

In this post, I have managed some of the common features of user mailbox with PowerShell which can make system engineer’s life little easier. There are several other user mailbox features available you can explore and try.

Let me know about your experience through comments. Have a good day!!

Related materials:

Views All Time Views All Time 5 Views Today Views Today 21

Appreciate how useful this article was to you? No Ratings Yet

No Ratings Yet

Loading... Loading...