Powershell 3.0 - Get-Counter -ontinuous返回错误c0000bc4

时间:2014-04-04 17:45:51

标签: powershell

在尝试使用“Get-Counter -Continuous”时,我收到以下错误:

PS C:\Windows\system32> 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,我会收到我期望看到的内容。

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

1 个答案:

答案 0 :(得分:2)

可在此网址找到效果计数器的错误代码: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:\Users\Trevor> (Get-Counter).CounterSamples.Path
\\cid-win81\network interface(intel[r] 82579lm gigabit network connection)\bytes total/sec
\\cid-win81\network interface(intel[r] centrino[r] ultimate-n 6300 agn)\bytes total/sec
\\cid-win81\network interface(isatap.{7cf0580e-071d-46ce-99fe-58328b0b7b35})\bytes total/sec
\\cid-win81\network interface(teredo tunneling pseudo-interface)\bytes total/sec
\\cid-win81\network interface(isatap.{11c74532-d485-4064-bcc4-3c595d90aec1})\bytes total/sec
\\cid-win81\network interface(isatap.{4c5f7956-2451-493b-8a9f-d0331c8d38d2})\bytes total/sec
\\cid-win81\processor(_total)\% processor time
\\cid-win81\memory\% committed bytes in use
\\cid-win81\memory\cache faults/sec
\\cid-win81\physicaldisk(_total)\% disk time
\\cid-win81\physicaldisk(_total)\current disk queue length