Removing an Exchange Server Mailbox from your environment

by [Published on 28 March 2017 / Last Updated on 28 March 2017]

The process to remove Exchange Server from an Exchange Organization on-premises.

Most of the articles are about new installation, deployment, adding more features and etc. Today, we are going over a different topic which is the process to remove Exchange Server 2016 server from an existent environment. In this article, we will focus on removing from a single server and in a future article here at MSExchange.org we will be removing Exchange Server from a member of a DAG (Database Availability Group).

Preparing the server to be removed…

Before going to the technical steps in removing an Exchange Server from an Exchange Organization, make sure to validate these following key points:

•Remove AV from the server
•Remove the Backup agent from the server
•Remove the Monitoring agents, when using SCOM, make sure to remove the agent from the console as well
•A restart of the server before starting the process is always helpful
•Make sure that you moved all mailboxes from the server that you are trying to remove

A good way to test if the server has any mailbox hosted, it is running the following cmdlet, and it will provide a list of all current mailboxes being hosted on the desired server.

Get-Mailbox –Server <ServerName>

If you want the specific number of mailboxes, and don’t want to copy and paste that information into Excel, you can run the following cmdlet:

(Get-Mailbox –Server <ServerName>).count

Another way to make sure that the mailboxes are gone is by trying to delete the Mailbox Databases themselves, if there is any mailbox being hosted an error will be displayed and we won’t be able to delete it. In order to list all databases of any given server, the following cmdlet can be used.

Get-MailboxDatabase –Server <ServerName>

If there is any mailbox still hosted on the server, the administrator can use EAC (Exchange Admin Center) or use the following cmdlet to move the mailbox to another mailbox database.

New-MoveRequest <mailbox> -TargetDatabase <Database-Destination>

The administrator must check the Receive Connectors, perhaps the server that is being removed has a special relay connector or something like that.  A regular Exchange Server 2016 will have five (5) Receive connectors and their names will match the names listed on the image depicted below.

Image
 
We must check the Send Connectors as well, using the following cmdlet all Send Connectors of the organization will be checked against the server name, the expected result is a clean output.

Get-SendConnector | Select Identity –ExpandProperty SourceTransportServers | Where-Object { $_.Name –eq ‘<ServerName>’}

Removing Exchange Server using the graphical user interface…

When removing a server that is by itself which means not a part of database availability group, the process is extremely simple, just open Control Panel, click on Uninstall a program, then select Microsoft Exchange Server 2016 (Item 1) from the list and click on Uninstall (Item 2).

Image
 
The Exchange Server setup will start a wizard to remove the product, just follow using default values and the uninstallation process should occur smoothly.  One nice feature on the uninstall process is the Readiness Checks which will check the current server and point out any issues that will not allow the removal of the current server from the Exchange Organization. The administrator must check the error messages and fix all the errors listed before moving forward with the removal process.

Image
 
Using the command line interface...

We can also use the command line interface to uninstall Exchange Server, logged as administrator on the command prompt and using the ISO file from the installation the following command can be used.

Setup /mode:uninstall /IAcceptExchangeServerLicenseTerms

Image
 
Removing manually…

This section you should use as a last instance and when the server is not coming back to life with the same name. It is ideal for any server that is being decommissioned and they will be formatted and repurposed to another role and/or service.

This task can be performed from any server with Active Directory tools installed and not necessarily from Exchange Server. Open ADSIEdit (click on run and type adsiedit.msc). Right click on the first icon on the left side and click on Connect to… and on the new dialog box, make sure to select Configuration, and click OK.

Image
 
Now we have to go deeper inside of the Active Directory configuration to find the server that we want to remove.

1. Expand Configuration (Item 1)
2. Expand CN=Configuration (Item 2)
3. Expand CN=Services (Item 3)
4. Expand CN=Microsoft Exchange (Item 4)
5. Expand CN=<Organization Name> (Item 5)
6. Expand CN=Administrative Groups (Item 6)
7. Expand CN=Exchange Administrative Group (FYDIBOHF23SPDLT) (item 7)
8. Expand CN=Servers
9. Right click on the desired server listed on the right side and click on Delete
10. Confirm the operation by clicking on Yes on the confirmation dialog box
11. A new dialog box asking to confirm the deletion of the container and everything in it will pop up, click on Yes again.

Image
 
After removing an Exchange Server manually, the administrator must check other settings where that server may have been configured in the Exchange Organization, for example: Send Connectors, Databases, Database Replication, Receive Connectors used by this server, Load Balancers pointing out to that server, and so forth.

See Also


The Author — Anderson Patricio

Anderson Patricio avatar

Anderson Patricio is a Canadian MVP in Cloud and Datacenter Management, and Office Server and Services, besides of the Microsoft Award he also holds a Solutions Master (MCSM) in Exchange and several other certifications. Anderson contributes to the Microsoft Community with articles, tutorials, blog posts, twitter, forums and book reviews. He is a regular contributor here at ITPROCentral.com, MSExchange.org, Techgenix.com and Anderson Patricio.org (Portuguese).