I am installing NSB infrastructure using Powershell cmdlets. I tried on some test virtual machines and it seems to work ok. However, in production, on Windows 2008 R2 machine I get the following error
PS C:\temp\mcbus\1> Install-NServiceBusPerformanceCounters
Install-NServiceBusPerformanceCounters : Category does not exist.
At line:1 char:1
+ Install-NServiceBusPerformanceCounters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-NServiceBusPerformanceCounters], InvalidOperationException
+ FullyQualifiedErrorId : System.InvalidOperationException,NServiceBus.PowerShell.InstallPerformanceCounters
I tried to do lodctr /R but it did not help.
I also found that the category can be removed by this command
[Diagnostics.PerformanceCounterCategory]::Delete( "NServiceBus" )
It really works when I go to the Powershell window, issue this command and do Install-NServiceBusPerformanceCounters, then it works. If I repeat issuing Install-NServiceBusPerformanceCounters, it says that performance counters already exist so everything is fine. NSB.Host.exe also starts properly.
However, when I run my msi, from where the Powershell script is invoked, the error returns.