【问题标题】:Get-Counter: negative denominator?Get-Counter:负分母?
【发布时间】:2012-07-25 02:11:05
【问题描述】:

我正在运行这个 Powershell 命令:

Get-counter -Counter "\Processor(_Total)\% Processor Time" –Continuous

我在http://technet.microsoft.com/en-us/magazine/ee872428.aspx找到的

我正在使用它来监控 CPU,但是在运行它大约一分钟后发生了这个错误(导致它停止):

Get-Counter : A counter with a negative denominator value was detected.
At line:1 char:12
+ Get-counter <<<<  -Counter "\Processor(_Total)\% Processor Time" -Continuous
    + CategoryInfo          : InvalidResult: (:) [Get-Counter], Exception
    + FullyQualifiedErrorId : CounterApiError,Microsoft.PowerShell.Commands.GetCounterCommand

是什么导致了这种情况发生?我能做些什么来防止这种情况,所以命令不会像这样中止(比如抑制错误)?

不过,我无法定期重现此内容。

【问题讨论】:

    标签: powershell


    【解决方案1】:

    如果您的代码看起来像 link 中的示例,其他人似乎也有同样的问题。不过可能是你的环境有问题。您拥有的每台电脑上都会发生这种情况吗?

    powershell 家伙似乎也有一些信息可以帮助您解决这个问题Powershell guy's blog。他基本上只是添加了这个命令-EA静默继续并导入计数器。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-09-19
      • 2020-04-27
      • 2019-05-09
      • 2014-04-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多