Hello,
I'm trying to run the following script in powershell:
$counters = @()
$counters = $counters + [Diagnostics.CounterCreationData]::("Hit counter", "Number of total hits", [Diagnostics.PerformanceCounterType]::NumberOfItem32);
$counters = $counters + [Diagnostics.CounterCreationData]::("Hits per second", "Number of average hits per second", [Diagnostics.PerformanceCounterType]::RateOfCountsPerSecond32);
$counterCollection = [Diagnostics.CounterCreationDataCollection]::($counters);
[Diagnostics.PerformanceCounterCategory]::Create("HitCounters","Some help text",[Diagnostics.PerformanceCounterCategoryType]::SingleInstance, $counterCollection);
When I execute this, I get an error saying $counterCollection is null. I'm afraid I'm not yet familiar enough with powershell to sort out where this is going wrong - is it the array I'm building the Collection from? Or the CounterCreationDataCollection creation call itself?
Any pointers are more than welcome :)