Powershell 3.0 - 获取计数器 - 连续返回错误 c0000bc4



在尝试使用"Get-Counter -Continu"时,我收到以下错误:

PS C:Windowssystem32> Get-Counter -Continuous
Get-Counter : The default values for this command failed. Error: c0000bc4.
At line:1 char:1
+ Get-Counter -Continuous
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (:) [Get-Counter], Exception
+ FullyQualifiedErrorId : CounterPathTranslationFailed,Microsoft.PowerShell.Commands.GetCounterCommand
Get-Counter : The specified object was not found on the computer.
At line:1 char:1
+ Get-Counter -Continuous
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (:) [Get-Counter], Exception
+ FullyQualifiedErrorId : CounterApiError,Microsoft.PowerShell.Commands.GetCounterCommand
Get-Counter : The default values for this command failed. Error: c0000bc4.
At line:1 char:1
+ Get-Counter -Continuous
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (:) [Get-Counter], Exception
+ FullyQualifiedErrorId : CounterPathTranslationFailed,Microsoft.PowerShell.Commands.GetCounterCommand
Get-Counter : The specified object was not found on the computer.
At line:1 char:1
+ Get-Counter -Continuous
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (:) [Get-Counter], Exception
+ FullyQualifiedErrorId : CounterApiError,Microsoft.PowerShell.Commands.GetCounterCommand
Get-Counter : The default values for this command failed. Error: c0000bc4.
At line:1 char:1
+ Get-Counter -Continuous
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (:) [Get-Counter], Exception
+ FullyQualifiedErrorId : CounterPathTranslationFailed,Microsoft.PowerShell.Commands.GetCounterCommand
Get-Counter : The specified object was not found on the computer.
At line:1 char:1
+ Get-Counter -Continuous
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (:) [Get-Counter], Exception
+ FullyQualifiedErrorId : CounterApiError,Microsoft.PowerShell.Commands.GetCounterCommand
Get-Counter : The default values for this command failed. Error: c0000bc4.
At line:1 char:1
+ Get-Counter -Continuous
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (:) [Get-Counter], Exception
+ FullyQualifiedErrorId : CounterPathTranslationFailed,Microsoft.PowerShell.Commands.GetCounterCommand
Get-Counter : The specified object was not found on the computer.
At line:1 char:1
+ Get-Counter -Continuous
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (:) [Get-Counter], Exception
+ FullyQualifiedErrorId : CounterApiError,Microsoft.PowerShell.Commands.GetCounterCommand
Get-Counter : The default values for this command failed. Error: c0000bc4.
At line:1 char:1
+ Get-Counter -Continuous
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (:) [Get-Counter], Exception
+ FullyQualifiedErrorId : CounterPathTranslationFailed,Microsoft.PowerShell.Commands.GetCounterCommand
Get-Counter : The specified object was not found on the computer.
At line:1 char:1
+ Get-Counter -Continuous
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (:) [Get-Counter], Exception
+ FullyQualifiedErrorId : CounterApiError,Microsoft.PowerShell.Commands.GetCounterCommand
Get-Counter : The default values for this command failed. Error: c0000bc4.
At line:1 char:1
+ Get-Counter -Continuous
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (:) [Get-Counter], Exception
+ FullyQualifiedErrorId : CounterPathTranslationFailed,Microsoft.PowerShell.Commands.GetCounterCommand
Get-Counter : The specified object was not found on the computer.
At line:1 char:1
+ Get-Counter -Continuous
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (:) [Get-Counter], Exception
+ FullyQualifiedErrorId : CounterApiError,Microsoft.PowerShell.Commands.GetCounterCommand

我正在使用Powershell 3.0 - 我已经在Powershell ISE中尝试过这个,Powershell提示符和cmd提示符无济于事 - 所有这些都在管理员模式下。 例如,如果我运行 Get-Process,我会得到我期望看到的内容。

请帮助我了解我做错了什么!

可以在以下 URL 中找到性能计数器的错误代码:http://msdn.microsoft.com/en-us/library/windows/desktop/aa373046(v=vs.85).aspx

您提到的特定错误代码映射到此错误:

0xC0000BC4 (PDH_INVALID_PATH)   The specified counter path could not be interpreted.

请运行以下命令以获取系统上计数器的完整列表,然后选择一个进行测试:

$AllCounters = Get-Counter -ListSet * | ForEach-Object -Process { $PSItem.Paths; $PSItem.PathsWithInstances; }
Get-Counter -Counter $AllCounters[5];

编辑:从我的系统添加默认计数器路径

PS C:UsersTrevor> (Get-Counter).CounterSamples.Path
\cid-win81network interface(intel[r] 82579lm gigabit network connection)bytes total/sec
\cid-win81network interface(intel[r] centrino[r] ultimate-n 6300 agn)bytes total/sec
\cid-win81network interface(isatap.{7cf0580e-071d-46ce-99fe-58328b0b7b35})bytes total/sec
\cid-win81network interface(teredo tunneling pseudo-interface)bytes total/sec
\cid-win81network interface(isatap.{11c74532-d485-4064-bcc4-3c595d90aec1})bytes total/sec
\cid-win81network interface(isatap.{4c5f7956-2451-493b-8a9f-d0331c8d38d2})bytes total/sec
\cid-win81processor(_total)% processor time
\cid-win81memory% committed bytes in use
\cid-win81memorycache faults/sec
\cid-win81physicaldisk(_total)% disk time
\cid-win81physicaldisk(_total)current disk queue length

最新更新