Decommissioning Exchange 2016 Server

By AJ Bajada

I have created many labs over the years and never really spent the time to decommission my environment, I usually just blow it away and start again. So I finally decided to go through the process and decommission my Exchange 2016 server in my lab environment.

My lab consisted of the following:

Being a lab I only had one Exchange server which had the mailbox role configured and was also my hybrid server.

Proceed with the steps below to remove the Exchange Online configuration;

  1. Connect to Exchange Online using PowerShell

  2. Remove the Inbound connector

    Remove-InboundConnector -Identity "Inbound from [Inbound Connector ID]"
    
  3. Remove the Outbound connector

    Remove-OutboundConnector -Identity "Outbound to [Outbound Connector ID]"
    
  4. Remove the Office 365 federation

    Remove-OrganizationRelationship "O365 to On-premises - [Org Relationship ID]"
    
  5. Remove the OAuth configuration

    Remove-IntraOrganizationConnector -Identity "HybridIOC - [Intra Org Connector ID]"
    

Now connect to your Exchange 2016 server and conduct the following;

  1. Open Exchange Management Shell
  2. Remove the Hybrid Config

    Remove-HybridConfig
    
  3. Remove the federation configuration

    Remove-OrganizationRelationship "On-premises to O365 - [Org Relationship ID]"
    
  4. Remove OAuth configuration

    Remove-IntraorganizationConnector -Identity "HybridIOC - [Intra Org Connector ID]"
    
  5. Remove all mailboxes, mailbox databases, public folders etc.

  6. Uninstall Exchange (either via PowerShell or programs and features)

    Setup /Mode:Uninstall /iacceptexchangeserverlicenseterms
    
  7. Decommission server

I also confirmed Exchange was removed from Active Directory and I was able to run another installation of Exchange on the same Active Directory with no conflicts or issues.


categories · links · piano · posts · scripts · THEAARBS · home