我想在PowerShell中显示一秒钟内的上下文切换次数。我到目前为止一直试图在Get-Counter -Counter "System\Context Switches/sec"
与“分”与“”和两个导致错误:Powershell计数上下文开关
Get-Counter : Internal performance counter API call failed. Error: c0bc4
我知道的性能监视器的显示这种能力,我需要它显示为PowerShell中的文本。
我想在PowerShell中显示一秒钟内的上下文切换次数。我到目前为止一直试图在Get-Counter -Counter "System\Context Switches/sec"
与“分”与“”和两个导致错误:Powershell计数上下文开关
Get-Counter : Internal performance counter API call failed. Error: c0bc4
我知道的性能监视器的显示这种能力,我需要它显示为PowerShell中的文本。
Geeze,我刚刚意识到这些命令是语言特定的。我的挪威体系只接受挪威的命令。这样就解决了我的问题!
挪威命令:Get-Counter -Counter "\System\Kontekstvekslinger/sek"
您错过了领先的\
。这将工作:
get-counter -Counter "\System\Context Switches/sec"
尝试将计算机名称放在路径中。
get-counter -Counter "\\<computer-name>\System\Context Switches/sec"
虽然archo444答案应该工作。
我测试过这个,结果相同:-( – Thomas 2015-03-31 10:23:31
$All = Get-Counter -ListSet * | ForEach-Object -Process { $PSItem.Paths; $PSItem.PathsWithInstances; }
get-counter -Counter ($All | Select-String -Pattern "context")
我得到同样的错误,像你我尝试这样,并得到结果精细
你可以发布正确的命令,仅供将来参考。 – dimm 2015-03-31 10:35:57
@dimm是的,完成了。 – Thomas 2015-03-31 10:39:54