tags:

views:

134

answers:

1

I inherited a piece of code from a recently-retired colleague that gets the total physical memory on a box and, when I perform the following on Windows XP and Server 2003, it works fine:

memSize = 0
set colItems = wmi.execQuery("select * from Win32_LogicalMemoryConfiguration")
for objItem in colItems
    memSize = memSize + objItem.TotalPhysicalMemory
next

On Windows Server 2008 however, it appears to hang in the for statement (based on copious debugging statements after every line which are not shown in the example).

Any ideas why?

+2  A: 

The Win32_LogicalMemoryConfiguration class has been deprecated. Try the Win32_OperatingSystem class instead. It should give the proper results on Server 2008.

I believe the property you're interested in is TotalVisibleMemorySize.

Jim H.
Why TotalVisibleMemorySize? I'm trying to figure out the actual physical RAM - that appears to only give the RAM available to Windows. +1 for the deprecation, though. Thanks for that.
paxdiablo
@Angry, I found the right value eventually (a while ago, it took me some time to get back to this question) and, since it was your deprecation comment that led me to it (well, that and the fact that no-one else bothered to answer, I'll accept this answer :-). Thanks.
paxdiablo