UsedMem.vbs:

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _

& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colSettings = objWMIService.ExecQuery _

("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colSettings

FreePhysMem = objOperatingSystem.FreePhysicalMemory

Wscript.Echo "# Total Virtual Memory: " & (Round(_

objOperatingSystem.TotalVirtualMemorySize / 1024)) & " MB"

Wscript.Echo "# Available Virtual Memory: " & (Round(_

objOperatingSystem.FreeVirtualMemory / 1024)) & " MB"

Next

Set colSettings = objWMIService.ExecQuery _

("Select * from Win32_ComputerSystem")

For Each objComputer in colSettings

Wscript.Echo "# Total Physical Memory: " & (Round((_

objComputer.TotalPhysicalMemory / 1024 ) / 1024)) & " MB"

Wscript.Echo "# Available Physical Memory: " & (Round(_

FreePhysMem /1024)) & " MB"

percentusedPhysicalMemory = 100 * (FreePhysMem /(objComputer.TotalPhysicalMemory / 1024))

Wscript.Echo "# Percent Physical Memory: " & (Round(percentusedPhysicalMemory,2)) & " %"

Wscript.Echo (Round(percentusedPhysicalMemory))

Wscript.Echo "# _CALAMON_SET_SLOT_ error_id UsedMemory"

Next

WScript.Quit 0

Test script on command line. Make sure there is no output to std_err and no output without leading # other than the value:

E:\temp>cscript /nologo .\usedmem.vbs

# Total Virtual Memory: 16311 MB

# Available Virtual Memory: 10592 MB

# Total Physical Memory: 8119 MB

# Available Physical Memory: 3102 MB

# Percent Physical Memory: 38,2 %

38

# _CALAMON_SET_SLOT_ error_id UsedMemory

E:\temp>