检查进程的CPU使用情况,但它会抛出输出以及出错

时间:2016-10-03 05:09:13

标签: powershell

编写以下脚本,以降序排列10个进程的最高CPU。它提供了所需的输出,但有错误。如何抑制此错误?

{{1}}

给出以下输出错误:

Get-Counter : The data in one of the performance counter samples is not valid.
View the Status property for each PerformanceCounterSample object to make sure
it contains valid data.
At line:1 char:1
+ Get-Counter -Computername RKCDR1 -Counter '\Process(*)\% Processor Time' | ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidResult: (:) [Get-Counter], Exception
    + FullyQualifiedErrorId : CounterApiError,Microsoft.PowerShell.Commands.GetCounterCommand

InstanceName            CookedValue
------------            -----------
_total             199.988940611584
idle               110.931365495488
verasmart          87.4951615175681
sqlservr             1.562413598528
callmanagerexpress                0
wmiprvse                          0
msdtc                             0
spserver                          0
felt32                            0
java                              0

0 个答案:

没有答案