Link to home
Start Free TrialLog in
Avatar of techieBrandon
techieBrandonFlag for United States of America

asked on

Using WMIC to obtain system details, results not as expected

I am working on using Window's WMIC to obtain the total physical memory and total virtual memory (along with numerous other things). I get the expected total physical memory using:

C:\Documents and Settings\Administrator>wmic MemLogical get TotalPhysicalMemory /Value


TotalPhysicalMemory=1571760

This looks roughly about right since I have 1.5 GB of RAM on this machine. The problem is when I look for my total virtual memory I get:

C:\Documents and Settings\Administrator>wmic MemLogical get TotalVirtualMemory /Value


TotalVirtualMemory=890788

My Virtual Memory Settings:

Space available: 11738

Custom size:
Initial size: 2046
Max size: 4092

Total paging file size for all drives:
Min allowed: 2 MB
Recommended: 2301 MB
Currently allocated: 2046 MB

I cannot figure out what is being returned upon my total virtual memory request. Thus far I have not been able to find solid documentation on WMIC though I have found a few sources, none authoritize though. I noticed that VB has replicated this functionality at http://msdn.microsoft.com/en-us/library/esy1c522.aspx which states that the return is in bytes, however when doing the conversions I cannot figure out what the returned value trully represents.


Anyone have further insight, references?
Avatar of SysExpert
SysExpert
Flag of Israel image

What does winmsd show you ? ( sysinfo32 )

You might find that you get more info there, and it can be run to create a test report with lots of relevant info.

Works on win98 and newer.


I hope this helps !
Avatar of techieBrandon

ASKER

Thanks for the response, sorry for my delay.

I did some trials with winmsd but it does not output the virtual memory, or processor speed, in other regards a good tool though.

C:\Documents and Settings\Administrator>winmsd /a /f > 

[TpSmry.txt...


*******************************  SYSTEM SUMMARY  *******************************
OS information: Microsoft Windows XP
OS version: 5.10.2600   Service Pack 2
Processor: x86 Family 6 Model 9 Stepping 5
Memory: 1,571,760 kb
BIOS version: 3.16  (1RETDKWW)
Machine type-Model: 23738U2

******************************  BIOS INFORMATION  ******************************

...]
It looks like you're trying to get to the TotalPageFileSpace (the amount of Physical Page file + the amount of Physical Ram).   Is that correct?   If so, then just use:
    wmic MemLogical get TotalPageFileSpace /Value
The documentation for these values is at:  http://msdn.microsoft.com/en-us/library/aa394181.aspx
Note:  There is a comment in the documentation that says that these values are no longer supported and to use another value instead.   But it seems to still work for me
Hi grave, thanks for the response.

What I am looking for is the virtual memory configured for the current operating system. The command would be:

wmic MemLogical get TotalVirtualMemory /Value

The problem I am having is the result, which is:

TotalVirtualMemory=890788

I am unsure what this 890788 is measured in, kb or byte I would assume but doing the math it doesn't fit with what I would expect on this machine.

I will have a look at the site you linked shortly. Thanks!
Just FYI, the command:

C:\Documents and Settings\Administrator>systeminfo

results:

[...
Total Physical Memory:     1,535 MB
Available Physical Memory: 58 MB
Virtual Memory: Max Size:  2,048 MB
Virtual Memory: Available: 1,996 MB
Virtual Memory: In Use:    52 MB
...]
depends on the OS.

IN XP it does show RAM, CPU speed and a bunch of other stuff by category

try winmsd /report filename.txt
also called msinfo32 on XP and newer.


Well... it's quite possible that the reason that you're getting bad informatio from the Win32_LogicalMemoryConfiguration class is because it's no longer supported.
Recall that I mentioned that the documentation suggests that you discontinue using Win32_LogicalMemoryConfiguration  (which uses the alias of "MemLogical" in WMIC) and instead use similar fields from the Win32_OperatingSystem class (which uses the alias of "OS" in WMIC)
Hey, thanks to both of you for quick response, sorry mine haven't been as prompt.

I will give both a shot this afternoon and see what works and make another post later. Thanks again
I have not had time to look into this any further, will update ASAP
ASKER CERTIFIED SOLUTION
Avatar of techieBrandon
techieBrandon
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial