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 article helpful? Looking to deploy a new, easy-to-manage, and cost-effective hyperconverged infrastructure?
Alex Bykovskyi
Alex Bykovskyi StarWind Virtual HCI Appliance Product Manager
Well, we can help you with this one! Building a new hyperconverged environment is a breeze with StarWind Virtual HCI Appliance (VHCA). It’s a complete hyperconverged infrastructure solution that combines hypervisor (vSphere, Hyper-V, Proxmox, or our custom version of KVM), software-defined storage (StarWind VSAN), and streamlined management tools. Interested in diving deeper into VHCA’s capabilities and features? Book your StarWind Virtual HCI Appliance demo today!