RemoveReplicaFromPFRecursive.ps1 returns "There is no existing PublicFolder that matches the following identity"

I was trying to retire my SBS 2008 box after migrating to SBS 2011 and I couldn't uninstall Exchange Server. I kept getting errors that I needed to remove the replica sets from the public folders. But when I would run the RemoveReplicaFromPFRecursive.ps1 script is would error out over and over no matter what I put in it. By the way, if you get an error that "A positional parameter cannot be found that accepts argument 'Folder'" it is because it doesn't like the space when you tried to type "Public Folder Database" so just use "\" instead.

I was beating myself up over that one for a while.

Anyway - if the script won't work you probably have an incorrect container with nothing inside in the path: CN=Second Storage Group,CN=InformationStore,CN={servername},CN=Servers,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC={domain},DC=local

I validated it was empty - and deleted it from ADSI edit and was then able to uninstall Exchange Server. If you don't know what ADSI edit is, you probably don't want to try this yourself without opening a support case. {sorry}

You can find a copy of this at my personal blog as well at https://www.9z.com/2011/05/removereplicafrompfrecursiveps1-returns-there-is-no-existing-publicfolder-that-matches-the-following.html