han*_*anu 2 memory powershell performance perfmon
我知道我可以在 中获取性能信息PerfMon
,但我不知道 Perfmon 中的哪个计数器检索这个值。
我想编写一个 PowerShell 脚本来找出过去一天的平均内存使用情况。PerfMon 是我能想到的唯一选择。在 PowerShell 中是否有更好的方法来执行此操作?
Get-Counter -Counter
是在 PowerShell 2+ 中获取性能计数器的方法。“使用中”看起来是以下四舍五入的值Total Memory - Available
:
[math]::Round(((((Get-Ciminstance Win32_OperatingSystem).TotalVisibleMemorySize * 1kb) - ((Get-Counter -Counter "\Memory\Available Bytes").CounterSamples.CookedValue)) / 1GB),1)
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1443 次 |
最近记录: |