How do I obtain Windows command line report of total committed memory (commit charge)?

3

1

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

Alexander Bird

Posted 2013-06-26T17:29:33.930

Reputation: 1 697

Answers

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.

Karan

Posted 2013-06-26T17:29:33.930

Reputation: 51 857

Hi!). CommitLimit not a Commit Charge Peak – STTR – 2013-06-26T18:22:30.663

1@STTR: He wants Commit Charge Total. Isn't that the same as CommittedBytes? The values certainly seem to match on my PC. – Karan – 2013-06-26T18:42:48.300

1http://blog.whatsupduck.net/2010/05/querying-peak-commit-bytes-with.html it not : wmic path Win32_PerfFormattedData_PerfOS_Memory get CommittedBytes, CommitLimit – STTR – 2013-06-26T18:51:23.813

@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 – 2013-06-26T18:59:43.210

Plz, see test script. – STTR – 2013-06-26T19:24:45.800

@STTR: Thanks a lot though for reminding me of the wmic command. Somehow I always turn to VBS/WSH first and forget about that. – Karan – 2013-06-26T19:26:08.480

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

STTR

Posted 2013-06-26T17:29:33.930

Reputation: 6 180

1The OP wants Total, not Peak. I must confess I still don't see what you're driving at. – Karan – 2013-06-26T19:27:47.733

@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 – 2013-06-26T19:48:16.887

1Karan 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 – Alexander Bird – 2013-06-26T20:16:30.217

@AlexanderBird script at Querying Peak Commit Bytes with Powershell (via NtQuerySystemInformation) article – STTR – 2013-06-26T20:22:01.630