Managing User Mailboxes in Microsoft Exchange Server 2016 with PowerShell

Posted by Karim Buzdar on November 22, 2017
Share on Facebook0Share on Google+0Share on LinkedIn1Share on Reddit9Tweet about this on Twitter0
No ratings yet.

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:

Views All Time
10
Views Today
17

Please rate this

To download the software products, please, make your choice below. An installer link and a license key will be sent to the e-mail address you’ve specified. If you consider StarWind Virtual SAN but are uncertain of the version, please check the following document Free vs. Paid. The recent build of Release Notes. A totally unrestricted NFR (Not For Resale) version of StarWind Virtual SAN is available for certain use cases. Learn more details here.



Return to all posts

Deploying SQL Server 2016 Basic Availability Groups Without Active Directory. Part 2: Configuring SQL Server
Take a look at Storage QoS Policies in Windows Server 2016
The following two tabs change content below.
Karim Buzdar
Karim Buzdar
Karim Buzdar holds a degree in telecommunication engineering and is a Microsoft Certified Solutions Associate (MCSA) for Server Infrastructure. As an IT engineer and technical author, he focuses on Microsoft Directory Services and PowerShell