This is just a quick summary of what’s required to remove Exchange 2010 from an SBS server, in its simplest form.

# Get rid of public folders
Get-PublicFolder "\" -Recurse -ResultSize:Unlimited | 
Remove-PublicFolder -Recurse -ErrorAction:SilentlyContinue

# Delete System Public folders
Get-PublicFolder "\Non_Ipm_Subtree" -Recurse -ResultSize:Unlimited | 
Remove-PublicFolder -Recurse -ErrorAction:SilentlyContinue

# Delete OABs
Get-OfflineAddressBook | Remove-OfflineAddressBook

# Remove send connectors
Get-SendConnector | Remove-SendConnector

# Delete the public folder database if it exists
Get-PublicFolderDatabase | Remove-PublicFolderDatabase

# Remove arbitration mailbox
Get-Mailbox -Arbitration | Disable-Mailbox -Arbitration -DisableLastArbitrationMailboxAllowed

# Remove any mailboxes by disabling - do not delete, as this deletes AD object also
Get-Mailbox | Disable-Mailbox

Then, we uninstall Exchange:

# Run the uninstall command
PS C:\Windows\system32> & 'C:\Program Files\Microsoft\Exchange Server\v14\Bin\Se
tup.com' /mode:uninstall

## Example results below

Welcome to Microsoft Exchange Server 2010 Unattended Setup

Preparing Exchange Setup

The following server roles will be removed
Mailbox Role
Client Access Role
Hub Transport Role
Management Tools
Languages

Performing Microsoft Exchange Server Prerequisite Check

    Configuring Prerequisites                                 COMPLETED
    Mailbox Role Checks                                       COMPLETED
    Client Access Role Checks                                 COMPLETED
    Hub Transport Role Checks                                 COMPLETED
    Organization Checks                                       COMPLETED

Configuring Microsoft Exchange Server

    Preparing Setup                                           COMPLETED
    Mailbox Server Role                                       COMPLETED
    Client Access Server Role                                 COMPLETED
    Hub Transport Server Role                                 COMPLETED
    Exchange Management Tools                                 COMPLETED
    Organization Preparation                                  COMPLETED
    Language Files                                            COMPLETED
    Stopping Services                                         COMPLETED
    Removing Exchange Files                                   COMPLETED
    Restoring Services                                        COMPLETED
    Finalizing Setup                                          COMPLETED

The Microsoft Exchange Server setup operation completed successfully.
PS C:\Windows\system32>

DNS Cleanup

Afterwards, have a look through your DNS to make sure that it has cleaned up entries such as mail, autodiscover, and other similar items. Be sure to check out SRV records also.

RD Gateway Fix

On occasion, removal of Exchange can break the Remote Desktop gateway. If this happens, Open IIS, then expand Sites -> Default Web Site, and select RPC.

Right click on this, and click “Explore”

In the resultant folder, there will be a file called web.config. Rename this to web.config.bak and then open up an administrative command prompt. In this, type iisreset and wait for your services to restart. This should resolve the issue.