我知道我可以在 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)
关于performance - perfmon如何获取 "in Use"内存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43006654/