如何通过Powershell获取Performance计数器的Explain Text
字符串值。
我认为这将是一个计数器的属性
Get-Counter -Counter "\Processor(_Total)\% Processor Time"|gm
(Get-Counter '\logicalDisk(*)\Avg. Disk Queue Length').countersamples|gm
答案 0 :(得分:2)
如果您可以调用.net框架对象,则可以访问PerformanceCounterCategory提供的所有方法。
以下内容可帮助您入门:
$categoryName = "Processor"
$categoryInstance = "_Total"
$counterName = "% Processor Time"
# Call the static method to get the Help for the category
$categoryHelp = [System.Diagnostics.PerformanceCounterCategory]::GetCategories() | ?{$_.CategoryName -like $categoryName} | select -expandproperty CategoryHelp
# Create an instance so that GetCounters() can be called
$pcc = new-object System.Diagnostics.PerformanceCounterCategory($categoryName)
$counterHelp = $pcc.GetCounters($categoryInstance) | ?{$_.CounterName -like $counterName} | select -expandproperty CounterHelp
$categoryHelp
$counterHelp