Removing last Exchange 2007 server from your organization

Had to uninstall exchange serve from SBS 2008, as it was the last Exchange server in organization I encountered number of problems trying to uninstall it.

One of those problems are that you cannot uninstall Exchange server while it contains Public Folder Replicas and you can't move them to another server because there is none.

Browsing the web I was finally able to solve this problem, for full artcile just follow the link and read the comments.
Here's summary:

1. You'll have to keep at least one mailbox with administrator rights.
2. Open Power-Shell and enter the following commands:

Get-PublicFolder -Server "\" -Recurse -ResultSize:Unlimited | Remove-PublicFolder -Server -Recurse -ErrorAction:SilentlyContinue

Get-PublicFolder -Server "\Non_Ipm_Subtree" -Recurse -ResultSize:Unlimited | Remove-PublicFolder -Server -Recurse -ErrorAction:SilentlyContinue

3. Remove all mailboxes on your server.
4. Remove Exchange 2007 server from "Programs and Features" in control panel.


Cannot access folder "Access Denied"

In cases when you need to access folder, but get "Access Denied" message even when you're logged on as an Administrator, you'll have to take ownership of that folder.
To do this in Windows Server 2003 open folder Properties, select Security tab and click on Advanced button, then hop on Owner tab. Now select user which will be the new owner of this folder and click OK (screenshot).