I have a custom performance counter category. Visual Studio Server Explorer refuses to delete it, claiming it is ‘not registered or a system category’. Short of doing it programmatically, how can I delete the category? Is there a registry key I can delete?
I have a custom performance counter category. Visual Studio Server Explorer refuses to delete
Share
As far as I know, there is no way to safely delete them except programatically (they’re intended for apps to create and remove during install) but it is trivial to do from a PowerShell command-line console. Just run this command:
HOWEVER: (EDIT)
You can delete the registry key that’s created, and that will make the category vanish.
For a category called ‘Inventory’ you can delete the whole key at
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Inventory… and although I wouldn’t be willing to bet that cleans up everything, it will make the category disappear. (If you run Process Monitor while running the Delete() method, you can see can a lot of other activity happening, and there doesn’t seem to be any other changes made).It’s important to note that as I said originally: when you get that error from Visual Studio, it might be that it’s already deleted and you need to refresh the view in VS. In my testing, I had to restart applications in order to get them to actually get a clean list of the available categories.
You can check the full list of categories from PowerShell to see if it’s listed:
But if you check them, then delete the registry key … they’ll still show up, until you restart PowerShell (if you start another instance, you can run the same query over there, and it will NOT show the deleted item, but re-running GetCategories in the first one will continue showing it.
By the way, you can filter that list if you want to using -like for patterns, or -match for full regular expressions: