简体   繁体   English

Powershell RAM高水位线

[英]powershell RAM high water mark

Is there a way to get the high water mark of RAM usage in powershell? 有没有办法在Powershell中获得较高的RAM使用率? Running on a 2008 R2 System. 在2008 R2系统上运行。

I was thinking I would have to write a script to turn on RAM counters, then use powershell to query? 我当时想我必须编写一个脚本来打开RAM计数器,然后使用powershell进行查询? Make sense? 说得通? Any examples? 有什么例子吗?

-Ken -肯

There is no Peak Memory Used counter for the entire box, but you can query the /Paging File/% Usage Peak. 整个框没有“已用峰值内存”计数器,但是您可以查询/ Paging File /%Usage Peak。 You may find this gives an indication of whatever event you're trying to monitor. 您可能会发现这表明您要监视的任何事件。

$categoryName = 'Paging File'                   
$counterName = '% Usage Peak'
$instanceName = '_Total'

$counter = "\$categoryName($instanceName)\$counterName"
Get-Counter $counter

There is also a set of Peaks for each running process. 每个运行过程也有一组峰。 If there's a particular service you're interested in (like inetinfo), then query for /Process(inetinfo)/Virtual Bytes Peak, Working Bytes Peak, Page File Bytes Peak. 如果有您感兴趣的特定服务(如inetinfo),则查询/ Process(inetinfo)/虚拟字节峰值,工作字节峰值,页面文件字节峰值。 The odds are this will get you closer to your real goal, anyway, of finding out where your memory's being consumed. 无论如何,这很可能使您更接近真正的目标,即找出消耗内存的位置。

If neither of those does what you want, then you'll need to set up an actual counter log. 如果这些都不满足您的要求,则需要设置一个实际的计数器日志。 This can be done programmatically via PowerShell (if you're trying to do this in bulk against a number of machines), but it's usually easier just to use the PerfMon Control Panel Applet. 可以通过PowerShell以编程方式完成此操作(如果您要针对多台计算机批量进行此操作),但是通常仅使用PerfMon控制面板小程序会更容易。 If you save that data to a .csv, you can then use PowerShell to analyze for maximum values of significant columns. 如果将数据保存到.csv,则可以使用PowerShell分析重要列的最大值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM