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 also see this article at my technet blog at http://blogs.technet.com/b/the_9z_by_chris_davis/archive/2011/05/17/removereplicafrompfrecursive-ps1-returns-quot-there-is-no-existing-publicfolder-that-matches-the-following-identity-quot.aspx

Put a BlackBox (Black Box) on your server!

So something I’ve been recommending to my customers for a while is to have the equivalent of an in flight data recorder on their server. You can do this with Perfmon with circular logging and it isn’t that hard to set up.

Why? Well take for example this scenario. You just got a call from one of your users that said the server was incredibly slow – you log on and everything looks fine. The user says yeah, it’s ok now but what happened?

Well, if it happens a couple more times – especially if someone or some automated process is waking you up in the middle of the night – you’re probably going to want to get to the bottom of this, right? Well, why wait until the problem happens again? Because you don’t have any data. Well now you can.

What you want to do is set Perfmon up so it ALWAYS runs. Keep a log of say 300 MB, 500 MB, or maybe a gigabyte of history. Set it up to start every time the machine starts up. And set it up to overwrite the log. This will always keep a history (similar to your event log) of what was just going on with the server in question.

Here’s how:

So the first thing you want to do is to have some counters, right? Wll which ones should you pick? Here is a template you can use. This is preloaded with all my personal favorites. If you know me very well then you know I teach a class from time to time called Vital Signs, which is all about learning performance monitor and what the various counters mean. This text file linked above are all the counters you’d need to solve 95%+ of the perf issues in the world.

So what do you do with it? First create a subfolder on C:\ (or whatever drive you want) and call it perflogs – if it isn’t already there. Then put the counters.txt file from above into that folder. Then all you need to do is type:

logman create counter BlackBox -cf c:\perflogs\counters.txt -si 05:00 -f bincirc -o c:\Perflogs\Blackbox.blg -a –v -max 500

What this will do is create a BLG (or binary logging file) in the perflogs subfolder. It will take a snapshot of all the counters in that counters.txt file every five minutes. It will run untill it hits 500MB and then it will just append to the file. So it will never grow beyond that size.

Then, all you need to do is start the log. You can type:

logman -start BlackBox

Now, here is the trick – this will keep that counter running until the machine reboots. So if you want it to keep running, put it into a startup script.

Then you’ll be able to look back into the log (to see what happened after someone calls and complains) by stopping the log either from inside of perfmon or from the command line by typing:

logman -stop BlackBox

Then copy the blackbox.blg file to your computer, start the blackbox back up again – and troubleshoot as normal.

(if you’re looking for advice on how to interpret perfmon counters, standby for a quick-tips post from me coming up later this month – or better yet, ask your Microsoft TAM about getting you into a Vital Signs class)

You can also find a copy of this article at my Technet Blog site: http://blogs.technet.com/b/the_9z_by_chris_davis/archive/2011/05/17/put-a-blackbox-black-box-on-your-server.aspx