Get-HeatmapCounter.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
function Get-HeatmapCounter { <# .Synopsis Gets the performance counters registered in the heatmap .Description Gets the performance counters registered in the heatmap. To add performance counters to the heatmap, use Add-PerformanceCounter. To remove performance counters from the heatmap, use Remove-PerformanceCounter .Example Get-HeatmapCounter .Link Add-HeatmapCounter .Link Remove-HeatmapCounter #> [CmdletBinding(DefaultParameterSetName='All')] param( # The name of a particular counter to get from the heatmap. By default, will get all counters. [Parameter(Mandatory=$true, ParameterSetName='ByName', ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] [string]$Name, # If set, gets the values from the heatmap, not the name [switch]$GetValue ) process { if ($psCmdlet.ParameterSetName -eq 'All') { #region Get All Counters if ($getValue) { $script:HeatMapCounters.Keys | Get-Counter } else { $script:HeatMapCounters.Keys } #endregion Get All Counters } elseif ($psCmdlet.ParameterSetName -eq 'ByName' ){ #region Get Counters by Name if ($getValue) { $script:HeatMapCounters.Keys | Where-Object { $_ -like $Name } | Get-Counter } else { $script:HeatMapCounters.Keys | Where-Object { $_ -like $Name } } #endregion Get Counters by Name } } } |