Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell计数上下文开关_Powershell_Context Switch - Fatal编程技术网

Powershell计数上下文开关

Powershell计数上下文开关,powershell,context-switch,Powershell,Context Switch,我试图在PowerShell中显示一秒钟内上下文切换的数量。到目前为止,我一直在尝试同时使用“”和“”的Get Counter-Counter“System\Context Switches/sec”,这两种方法都会导致错误: Get-Counter : Internal performance counter API call failed. Error: c0bc4 我知道perfmon能够显示这一点,我需要它在Powershell中显示为文本。您缺少一个前导\。这将有助于: get-co

我试图在PowerShell中显示一秒钟内上下文切换的数量。到目前为止,我一直在尝试同时使用“”和“”的
Get Counter-Counter“System\Context Switches/sec”
,这两种方法都会导致错误:

Get-Counter : Internal performance counter API call failed. Error: c0bc4

我知道perfmon能够显示这一点,我需要它在Powershell中显示为文本。

您缺少一个前导
\
。这将有助于:

get-counter -Counter "\System\Context Switches/sec"

您缺少一个前导的
\
。这将有助于:

get-counter -Counter "\System\Context Switches/sec"

尝试将计算机名放入路径中

get-counter -Counter "\\<computer-name>\System\Context Switches/sec"
获取计数器-计数器“\\\System\Context Switches/sec”

尽管archo444答案应该有效。

尝试将计算机名放入路径中

get-counter -Counter "\\<computer-name>\System\Context Switches/sec"
获取计数器-计数器“\\\System\Context Switches/sec”

虽然archo444的答案应该是可行的。

Geeze,但我刚刚意识到这些命令是特定于语言的。我的挪威系统只接受挪威命令。这就解决了我的问题


挪威命令:
Get Counter-Counter“\System\Kontekstvekslinger/sek”

Geeze,我刚刚意识到这些命令是特定于语言的。我的挪威系统只接受挪威命令。这就解决了我的问题

挪威命令:
Get Counter-Counter“\System\Kontekstvekslinger/sek”

我和你们一样也会犯同样的错误,我试着这样做,结果很好


我和你们一样也会犯同样的错误,我这样尝试,结果很好

嗨,我也尝试过,导致了同样的错误代码。编辑几乎相同的代码->c0bb9。适合我。当我使用你问题中的那个时,我得到了相同的错误代码。也在所有版本的powershell中试用过,并且在每个版本中都有效。你试过以管理员的身份运行吗?是的,我也以管理员的身份运行过,结果是一样的,奇怪!嗨,我也试过了,导致了相同的错误代码。编辑几乎相同的代码->c0bb9。适合我。当我使用你问题中的那个时,我得到了相同的错误代码。也在所有版本的powershell中试用过,并且在每个版本中都有效。你试过以管理员的身份运行吗?是的,我也以管理员的身份运行过,结果是一样的,奇怪!我也测试过,结果相同:-(我也测试过,结果相同:-(