dhathsato
asked on
Returning values with WMI
I need to return: Total System Cache, commit charge values and kernel memory values from a Win2003 machine. Currently I have been returning Total and available physical memory via WMI. Does anyone know what class to use to get the values mentioned above?
ASKER
Thank you for your response, it is very helpful. I still don't see how I can get the value of the System Cache, do I need to do calculations to get this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I was thinking that maybe the CacheBytes value above would be the actual "current" usage, whereas the one shown in Task Manager might be a long term calculation of averages or amount reserved.
Perhaps you should try to collect the CacheBytes value for a while and see if gets close to the Task Manager reported value, over time....
Regards,
Rob.
Perhaps you should try to collect the CacheBytes value for a while and see if gets close to the Task Manager reported value, over time....
Regards,
Rob.
cscript MemoryDetails.vbs
and you will see the output. See if that's what you need.
I got this code from Microsoft's ScriptoMatic v2, which allows to choose all of the published Win32 classes, and you should look through those to get what you need.
'===================
On Error Resume Next
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
arrComputers = Array("D09790RING")
For Each strComputer In arrComputers
WScript.Echo
WScript.Echo "=========================
WScript.Echo "Computer: " & strComputer
WScript.Echo "=========================
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("S
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
WScript.Echo "AvailableBytes: " & objItem.AvailableBytes
WScript.Echo "AvailableKBytes: " & objItem.AvailableKBytes
WScript.Echo "AvailableMBytes: " & objItem.AvailableMBytes
WScript.Echo "CacheBytes: " & objItem.CacheBytes
WScript.Echo "CacheBytesPeak: " & objItem.CacheBytesPeak
WScript.Echo "CacheFaultsPersec: " & objItem.CacheFaultsPersec
WScript.Echo "Caption: " & objItem.Caption
WScript.Echo "CommitLimit: " & objItem.CommitLimit
WScript.Echo "CommittedBytes: " & objItem.CommittedBytes
WScript.Echo "DemandZeroFaultsPersec: " & objItem.DemandZeroFaultsPe
WScript.Echo "Description: " & objItem.Description
WScript.Echo "FreeSystemPageTableEntrie
WScript.Echo "Frequency_Object: " & objItem.Frequency_Object
WScript.Echo "Frequency_PerfTime: " & objItem.Frequency_PerfTime
WScript.Echo "Frequency_Sys100NS: " & objItem.Frequency_Sys100NS
WScript.Echo "Name: " & objItem.Name
WScript.Echo "PageFaultsPersec: " & objItem.PageFaultsPersec
WScript.Echo "PageReadsPersec: " & objItem.PageReadsPersec
WScript.Echo "PagesInputPersec: " & objItem.PagesInputPersec
WScript.Echo "PagesOutputPersec: " & objItem.PagesOutputPersec
WScript.Echo "PagesPersec: " & objItem.PagesPersec
WScript.Echo "PageWritesPersec: " & objItem.PageWritesPersec
WScript.Echo "PercentCommittedBytesInUs
WScript.Echo "PoolNonpagedAllocs: " & objItem.PoolNonpagedAllocs
WScript.Echo "PoolNonpagedBytes: " & objItem.PoolNonpagedBytes
WScript.Echo "PoolPagedAllocs: " & objItem.PoolPagedAllocs
WScript.Echo "PoolPagedBytes: " & objItem.PoolPagedBytes
WScript.Echo "PoolPagedResidentBytes: " & objItem.PoolPagedResidentB
WScript.Echo "SystemCacheResidentBytes:
WScript.Echo "SystemCodeResidentBytes: " & objItem.SystemCodeResident
WScript.Echo "SystemCodeTotalBytes: " & objItem.SystemCodeTotalByt
WScript.Echo "SystemDriverResidentBytes
WScript.Echo "SystemDriverTotalBytes: " & objItem.SystemDriverTotalB
WScript.Echo "Timestamp_Object: " & objItem.Timestamp_Object
WScript.Echo "Timestamp_PerfTime: " & objItem.Timestamp_PerfTime
WScript.Echo "Timestamp_Sys100NS: " & objItem.Timestamp_Sys100NS
WScript.Echo "TransitionFaultsPersec: " & objItem.TransitionFaultsPe
WScript.Echo "WriteCopiesPersec: " & objItem.WriteCopiesPersec
WScript.Echo
Next
Next
'================
Regards,
Rob.