Search
StarWind is a hyperconverged (HCI) vendor with focus on Enterprise ROBO, SMB & Edge

Managing User Mailboxes in Microsoft Exchange Server 2016 with PowerShell

  • November 22, 2017
  • 11 min read
IT Engineer and Technical Author. Karim is specializing in Linux, he is a prolific blogger who writes for various websites.
IT Engineer and Technical Author. Karim is specializing in Linux, he is a prolific blogger who writes for various websites.

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.

Creating a User Mailbox

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

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.

create a user mailbox via PowerShell

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

prompt for the password during runtime via powershell

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

verify the mailbox has been created via powershell

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).

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 maibox via powershell command

Enabling a User Mailbox

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

Example

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

Enable Mailbox via powershell command

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 via powershell command

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.

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”.

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.

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.

Example

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

Changing User Mailbox Department and Title via powershell

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.

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.

issue warning, prohibit send, and prohibit send and receive quotas via powershell

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:

Hey! Found Karim’s insights useful? Looking for a cost-effective, high-performance, and easy-to-use hyperconverged platform?
Taras Shved
Taras Shved StarWind HCI Appliance Product Manager
Look no further! StarWind HCI Appliance (HCA) is a plug-and-play solution that combines compute, storage, networking, and virtualization software into a single easy-to-use hyperconverged platform. It's designed to significantly trim your IT costs and save valuable time. Interested in learning more? Book your StarWind HCA demo now to see it in action!