Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer
    
Hi!). CommitLimit not a Commit Charge Peak –  STTR Jun 26 '13 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 '13 at 18:42
1  
blog.whatsupduck.net/2010/05/… it not : wmic path Win32_PerfFormattedData_PerfOS_Memory get CommittedBytes, CommitLimit –  STTR Jun 26 '13 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 '13 at 18:59
    
Plz, see test script. –  STTR Jun 26 '13 at 19:24
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

share|improve this answer
1  
The OP wants Total, not Peak. I must confess I still don't see what you're driving at. –  Karan Jun 26 '13 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 '13 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 –  Alexander Bird Jun 26 '13 at 20:16
    
@AlexanderBird script at Querying Peak Commit Bytes with Powershell (via NtQuerySystemInformation) article –  STTR Jun 26 '13 at 20:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.