Main example
List instances
# Abstract class: Get-CimInstance returns the instances of its subclasses
Get-CimInstance -ClassName CIM_MemoryCapacity |
Select-Object -Property MemoryType, Name, Description, CaptionAbstract class: it has no instances of its own. Get-CimInstance returns the instances of its subclasses.
Examples
Decode numeric values
# Lookup table for MemoryType (values documented by Microsoft)
$memoryTypeName = @{
0 = 'Unknown'
1 = 'Other'
2 = 'DRAM'
3 = 'Synchronous DRAM'
4 = 'Cache DRAM'
5 = 'EDO'
6 = 'EDRAM'
7 = 'VRAM'
8 = 'SRAM'
9 = 'RAM'
10 = 'ROM'
11 = 'Flash'
12 = 'EEPROM'
13 = 'FEPROM'
14 = 'EPROM'
15 = 'CDRAM'
16 = '3DRAM'
17 = 'SDRAM'
18 = 'SGRAM'
19 = 'RDRAM'
20 = 'DDR'
21 = 'DDR-2'
}
Get-CimInstance -ClassName CIM_MemoryCapacity |
Select-Object -Property @(
@{ Name = 'MemoryType'; Expression = { $memoryTypeName[[int]$_.MemoryType] } }
'Name'
'Description'
'Caption'
)Query a remote computer (CIM session)
review before running# Name of the remote computer
$computerName = 'SERVER01'
# The CIM session (WSMan by default) can be reused for several queries
$cimSession = New-CimSession -ComputerName $computerName
try {
Get-CimInstance -CimSession $cimSession -ClassName CIM_MemoryCapacity |
Select-Object -Property MemoryType, Name, Description, Caption
} finally {
Remove-CimSession -CimSession $cimSession
}WSMan (WinRM) is used by default. For a host without WinRM, create the session with -SessionOption (New-CimSessionOption -Protocol Dcom). Add -Credential to use another account.
Show the class structure
# Class structure: properties, types and flags (Key, ReadOnly…)
$cimClass = Get-CimClass -ClassName CIM_MemoryCapacity
$cimClass.CimClassProperties |
Select-Object -Property Name, CimType, FlagsProperties
| Name | Type | Access | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Caption# | string | read | Short textual description of the object. Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description# | string | read | Textual description of the object. Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MaximumMemoryCapacity# | uint64 | read | Maximum amount of memory, in kilobytes, that can be supported by the associated physical element. For more information about using uint64 values in scripts, see Scripting in WMI. Unit: kilobytes Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MemoryType# key | uint16 | read | Type of memory, which is part of the object key. Values correspond to the list of possible memory types in the CIM_PhysicalMemory class. Values (22)
Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MinimumMemoryCapacity# | uint64 | read | Minimum amount of memory, in kilobytes, that is needed for the associated physical element to operate correctly. For more information about using uint64 values in scripts, see Scripting in WMI. Unit: kilobytes Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Name# key | string | read | The name of the object; serves as a part of the object key. Code |
Remarks
WMI does not implement this class.
This documentation is derived from the CIM class descriptions published by the DMTF. Microsoft may have made changes to correct minor errors, conform to Microsoft SDK documentation standards, or provide more information.
Inheritance
Superclass chain
- CIM_PhysicalCapacity
- CIM_MemoryCapacity
Known subclasses
No known subclass.
Requirements
- Namespace
- root/cimv2
- Minimum client
- Windows Vista
- Minimum server
- Windows Server 2008
- MOF file
- CIMWin32.mof
- DLL
- CIMWin32.dll
Class qualifiers
Abstract UUID("{FAF76B6B-798C-11D2-AAD1-006008C78BC7}") AMENDMENT
Microsoft source
Descriptions, properties and methods come from the Microsoft documentation (MicrosoftDocs/win32 repository), published under the CC BY 4.0 licence. Formatting and translations are specific to this site; the PowerShell examples are written for it.