protected override void ProcessRecord() { var performanceCounterSetup = new PerformanceCounterSetup(Host); if (performanceCounterSetup.DoesCategoryExist()) { performanceCounterSetup.DeleteCategory(); } else { WriteWarning("NServiceBus Performance Counters were not installed"); } }
void ForceCreate() { var setup = new PerformanceCounterSetup(Host); try { setup.DeleteCategory(); } catch (Exception exception) { var errorRecord = new ErrorRecord(exception, "FailedToDeleteCategory", ErrorCategory.NotSpecified, null); ThrowTerminatingError(errorRecord); } setup.SetupCounters(); }
void ForceCreate() { try { Host.UI.WriteLine("Deleting counters"); PerformanceCounterSetup.DeleteCategory(); } catch (Exception exception) { var errorRecord = new ErrorRecord(exception, "FailedToDeleteCategory", ErrorCategory.NotSpecified, null); ThrowTerminatingError(errorRecord); } Host.UI.WriteLine("Creating counters"); PerformanceCounterSetup.SetupCounters(); }