共用方式為


Win32_LogicalMemoryConfiguration class

[The Win32_LogicalMemoryConfiguration WMI class is no longer available for use ]

Represents the layout and availability of memory on a computer system running Windows.

Windows Server 2003: This class is no longer supported. Use the Win32_OperatingSystem class instead.

The following syntax is simplified from Managed Object Format (MOF) code and includes all of the inherited properties. Properties and methods are in alphabetic order, not MOF order.

Syntax

class Win32_LogicalMemoryConfiguration
{
  uint32 AvailableVirtualMemory;
  string Caption;
  string Description;
  string Name;
  string SettingID;
  uint32 TotalPageFileSpace;
  uint32 TotalPhysicalMemory;
  uint32 TotalVirtualMemory;
};

Members

The Win32_LogicalMemoryConfiguration class has these types of members:

  • Properties

Properties

The Win32_LogicalMemoryConfiguration class has these properties.

AvailableVirtualMemory

Data type: uint32

Access type: Read-only

Qualifiers: Deprecated, Units (Kilobytes)

Available (unreserved or uncommitted) amount of memory that a calling process can use. This property is no longer supported. You should use the FreeVirtualMemory property in CIM_OperatingSystem class instead.

Caption

Data type: string

Access type: Read-only

Short description of the CIM_Setting object.

Description

Data type: string

Access type: Read-only

Description of the CIM_Setting object.

Name

Data type: string

Access type: Read-only

Qualifiers: Key, Deprecated

Logical memory configuration. This property is no longer supported.

Example: "LogicalMemoryConfiguration"

SettingID

Data type: string

Access type: Read-only

Identifier by which the CIM_Setting object is known.

TotalPageFileSpace

Data type: uint32

Access type: Read-only

Qualifiers: Deprecated, Units (Kilobytes)

Total amount of memory that can be stored in the paging file. This property is no longer supported. You should use the SizeStoredInPagingFiles property in the CIM_OperatingSystem class instead.

TotalPhysicalMemory

Data type: uint32

Access type: Read-only

Qualifiers: Deprecated, Units (Kilobytes)

Total amount of physical memory as available to the operating system. This property is no longer supported. You should use the TotalVisualMemorySize property in the CIM_OperatingSystem class instead.

TotalVirtualMemory

Data type: uint32

Access type: Read-only

Qualifiers: Deprecated, Units (Kilobytes)

Total amount of memory available to a calling process. This property is no longer supported. You should use the TotalVirtualMemorySize property in the CIM_OperatingSystem class instead.

Remarks

The Win32_LogicalMemoryConfiguration class is derived from CIM_Setting.

Examples

The following VBScript sample retrieves the amount of physical memory installed on a computer.

strComputer = "."

Set objSWbemServices = GetObject("winmgmts:\\" & strComputer)
Set colSWbemObjectSet = _
 objSWbemServices.InstancesOf("Win32_LogicalMemoryConfiguration")

For Each objSWbemObject In colSWbemObjectSet
 Wscript.Echo "Total Physical Memory (kb): " & _
 objSWbemObject.TotalPhysicalMemory
Next

The following VBScript sample retrieves memory and CPU usage.

On Error Resume Next  
   
strComputer = "."  
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\Root\CIMV2")   
   
'Get CPU Usage   
myQuery = "SELECT * FROM Win32_PerfFormattedData_PerfOS_Processor WHERE Name = '_Total'"  
For Each objItem in objWMIService.ExecQuery(myQuery)   
   ProcTime = "Processor time " & objItem.PercentProcessorTime & "  %"  
next   
   
'Get Memory Information   
myQuery = "select FreeVirtualMemory,FreePhysicalMemory from Win32_OperatingSystem"  
for each objItem in objWMIService.ExecQuery(myQuery)   
    for each oProperty in objItem.Properties_   
        if oProperty.Name = "VirtualMemFreeMemory" then   
            VirtualMemFree = oProperty.Value   
        elseif oProperty.Name = "PhMemFreeMemory" then   
            PhMemFree = oProperty.Value   
        end if   
    next   
next   
  
myQuery = "select TotalVirtualMemory,TotalPhysicalMemory from Win32_LogicalMemoryConfiguration"  
for each objItem in objWMIService.ExecQuery(myQuery)   
    for each oProperty in objItem.Properties_   
        if oProperty.Name = "TotalVirtualMemory" then   
             VirtualTotal = oProperty.Value   
        elseif oProperty.Name = "TotalPhysicalMemory" then   
            PhysicalTotal = oProperty.Value   
        end if   
    next   
next   
   
VirtualUsed = 100 - (100 * (VirtualMemFree / VirtualTotal))   
PhysicalUsed = 100 - (100 * (PhMemFree / PhysicalTotal))   
   
wscript.echo Date() & " " & Time()   
wscript.echo "Processor Time : " & ProcTime   
wscript.echo "Percent Used Virutal Memory" & VirtualUsed   
wscript.echo "Percent Used Physical Memory" & PhysicalUsed  

Requirements

Minimum supported client

None supported

Minimum supported server

Windows Server 2003

End of client support

None supported

End of server support

Windows Server 2003

Namespace

Root\CIMV2

MOF

CIMWin32.mof

DLL

CIMWin32.dll

See also

Operating System Classes