gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 01:50:50 45 4
gpt4 key购买 nike

在尝试使用“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,我会返回我期望看到的内容。

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

最佳答案

性能计数器的错误代码可在此 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:\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

关于Powershell 3.0 - Get-Counter -Continuous 返回错误 c0000bc4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22869567/

45 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com