3

I want to have a small batch script which runs on a server and every hour logs memory statistics. I already have the script log the process-specific info I want via other tools, but I want to know of a way (either directly on cmd or via a program) which will output the total committed memory of the system. In other words, I think the commit charge total statistic in the Task Manager is what I want to know, but via the command line:

1

2 Answers 2

3

You can instantiate and use the Win32_PerfFormattedData_PerfOS_Memory class for this via VBScript:

Set wmiObject = GetObject("winmgmts:\\.\root\cimv2:Win32_PerfFormattedData_PerfOS_Memory=@")
Wscript.Echo "CommitLimit  (B): " & wmiObject.CommitLimit
Wscript.Echo "CommitLimit (MB): " & (wmiObject.CommitLimit / 1048576)
Wscript.Echo "CommittedBytes  (B): " & wmiObject.CommittedBytes
Wscript.Echo "CommittedBytes (MB): " & (wmiObject.CommittedBytes / 1048576)

Save with a name like GetMem.vbs and invoke using cscript //Nologo GetMem.vbs. The class can also be used via the wmic command as mentioned below, although of course a script provides you much more flexibility.

6
  • Hi!). CommitLimit not a Commit Charge Peak
    – STTR
    Jun 26, 2013 at 18:22
  • 1
    @STTR: He wants Commit Charge Total. Isn't that the same as CommittedBytes? The values certainly seem to match on my PC.
    – Karan
    Jun 26, 2013 at 18:42
  • 1
    blog.whatsupduck.net/2010/05/… it not : wmic path Win32_PerfFormattedData_PerfOS_Memory get CommittedBytes, CommitLimit
    – STTR
    Jun 26, 2013 at 18:51
  • @STTR: That blog post you linked to agrees with me. CommittedBytes is Commit Charge Total. Neither the OP nor I mentioned Commit Charge Peak, so I honestly fail to see what the problem is.
    – Karan
    Jun 26, 2013 at 18:59
  • Plz, see test script.
    – STTR
    Jun 26, 2013 at 19:24
0
wmic path Win32_PerfFormattedData_PerfOS_Memory get CommittedBytes, CommitLimit

Test script ...

These values ​​may be equal so long until RAM exhaustible (CommitLimit and PeakCommitment*(page size))

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

Peak ...

Querying Peak Commit Bytes with Powershell (via NtQuerySystemInformation)

enter image description here

enter image description here

4
  • 1
    The OP wants Total, not Peak. I must confess I still don't see what you're driving at.
    – Karan
    Jun 26, 2013 at 19:27
  • @Karan Well, OP wanted to Peak). It is best to use perfmon and save the results in a database. Let the OP will clarify the question)
    – STTR
    Jun 26, 2013 at 19:48
  • 1
    Karan is correct. It is currently the total (not peak) I am interested in. Also, I would add a link to that article in your answer so others know what you're referring to when you use the "PeakCommitment.ps1" command in your screenshots Jun 26, 2013 at 20:16
  • @AlexanderBird script at Querying Peak Commit Bytes with Powershell (via NtQuerySystemInformation) article
    – STTR
    Jun 26, 2013 at 20:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .