There are many classes available in CIM and WMI which are separated into multiple namespaces. The most common (and default) namespace in Windows is root/cimv2
. To find the righ class, it can useful to list all or search.
You can list all available classes in the default namespace (root/cimv2
) on a computer.
CIM:
Get-CimClass
WMI:
Get-WmiObject -List
You can search for specific classes using wildcards. Ex: Find classes containing the word process
.
CIM:
> Get-CimClass -ClassName "*Process*"
NameSpace: ROOT/CIMV2
CimClassName CimClassMethods CimClassProperties
------------ --------------- ------------------
Win32_ProcessTrace {} {SECURITY_DESCRIPTOR, TIME_CREATED, ParentProcessID, ProcessID...}
Win32_ProcessStartTrace {} {SECURITY_DESCRIPTOR, TIME_CREATED, ParentProcessID, ProcessID...}
Win32_ProcessStopTrace {} {SECURITY_DESCRIPTOR, TIME_CREATED, ParentProcessID, ProcessID...}
CIM_Process {} {Caption, Description, InstallDate, Name...}
Win32_Process {Create, Terminat... {Caption, Description, InstallDate, Name...}
CIM_Processor {SetPowerState, R... {Caption, Description, InstallDate, Name...}
Win32_Processor {SetPowerState, R... {Caption, Description, InstallDate, Name...}
...
WMI:
Get-WmiObject -List -Class "*Process*"
The root namespace is simply called root
. You can list classes in another namespace using the -NameSpace
parameter.
CIM:
> Get-CimClass -Namespace "root/SecurityCenter2"
NameSpace: ROOT/SecurityCenter2
CimClassName CimClassMethods CimClassProperties
------------ --------------- ------------------
....
AntiSpywareProduct {} {displayName, instanceGuid, pathToSignedProductExe, pathToSignedReportingE...
AntiVirusProduct {} {displayName, instanceGuid, pathToSignedProductExe, pathToSignedReportingE...
FirewallProduct {} {displayName, instanceGuid, pathToSignedProductExe, pathToSignedReportingE...
WMI:
Get-WmiObject -Class "__Namespace" -Namespace "root"
To find available child-namespaces of root
(or another namespace), query the objects in the __NAMESPACE
-class for that namespace.
CIM:
> Get-CimInstance -Namespace "root" -ClassName "__Namespace"
Name PSComputerName
---- --------------
subscription
DEFAULT
CIMV2
msdtc
Cli
SECURITY
HyperVCluster
SecurityCenter2
RSOP
PEH
StandardCimv2
WMI
directory
Policy
virtualization
Interop
Hardware
ServiceModel
SecurityCenter
Microsoft
aspnet
Appv
WMI:
Get-WmiObject -List -Namespace "root"