0

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.

Simon
  • 33,714
  • 21
  • 133
  • 202
Alexey Zimarev
  • 17,944
  • 2
  • 55
  • 83

1 Answers1

0

There is a pure PowerShell version of the NServiceBus Per Counters that is currently being worked on. It can be found here https://github.com/Particular/Packages.PerfCounters/blob/master/src/tools/setup.ps1

It is actually designed to be called from a Chocolatey package http://chocolatey.org/packages/nservicebus.perfcounters.install but should be able to be called directly

Simon
  • 33,714
  • 21
  • 133
  • 202
  • It does not help. The script behaves exactly the same as the cmdlet. It runs OK from WiX exec64 task but NSB host running immedaitely after reports that the counters are missing. Going in PS and running the script or cmdlet interactively resolves the problem. But this is not a good workaround since we MUST run the msi file unattended. – Alexey Zimarev Mar 20 '14 at 12:07
  • @AlexeyZimarev can you please raise an issue here https://github.com/Particular/Packages.PerfCounters/issues and include the log output from wix – Simon Mar 20 '14 at 13:15
  • I am talking to Particular support (we have a license) for a week now. – Alexey Zimarev Mar 20 '14 at 16:58