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:
- Domain Controller (Windows Server 2012 R2)
- AAD Connect Server
- Exchange 2016 Server/ Office 365 Hybrid
- Office 365 tenant
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;
Connect to Exchange Online using PowerShell
Remove the Inbound connector
Remove-InboundConnector -Identity "Inbound from [Inbound Connector ID]"
- Remove the Outbound connector
Remove-OutboundConnector -Identity "Outbound to [Outbound Connector ID]"
- Remove the Office 365 federation
Remove-OrganizationRelationship "O365 to On-premises - [Org Relationship ID]"
- Remove the OAuth configuration
Remove-IntraOrganizationConnector -Identity "HybridIOC - [Intra Org Connector ID]"
Now connect to your Exchange 2016 server and conduct the following;
- Open Exchange Management Shell
- Remove the Hybrid Config
- Remove the federation configuration
Remove-OrganizationRelationship "On-premises to O365 - [Org Relationship ID]"
- Remove OAuth configuration
Remove-IntraorganizationConnector -Identity "HybridIOC - [Intra Org Connector ID]"
- Remove all mailboxes, mailbox databases, public folders etc.
- Uninstall Exchange (either via PowerShell or programs and features)
Setup /Mode:Uninstall /iacceptexchangeserverlicenseterms
- 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.