[英]How to Determine the Average CPU Percentage using a Powershell Command and Output the CPU Percentage as a Numeric Percentage with no Labels
I'm am working to get a powershell command that allows me to pull the average cpu percentage over all the cores for a remote server, and output the value as just the numeric percentage. 我正在努力获得一个powershell命令,该命令使我可以将远程服务器的所有核心上的平均cpu百分比拉出,并将该值输出为数字百分比。 I am Close but have not been able find a way to just get the Numeric value.
我很接近,但一直无法找到一种方法来获取数值。 The Following is the command I am using followed by the output.
以下是我正在使用的命令,然后是输出。
Get-WmiObject -computer server -class win32_processor | Measure-Object -property LoadPercentage -Average | FL average
Average : 30.5
Thanks in advance for any Help! 在此先感谢您的帮助!
Try Select-Object
's ExpandProperty
parameter to get the value of a property. 尝试使用
Select-Object
的ExpandProperty
参数来获取属性的值。 Updated script: 更新的脚本:
Get-WmiObject -computer server -class win32_processor | Measure-Object -property LoadPercentage -Average | Select-Object -ExpandProperty Average
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.