Getting classes

The Get-CimClass command is used to return an instance of a WMI class:

PS> Get-CimClass Win32_Process

NameSpace: ROOT/cimv2

CimClassName CimClassMethods CimClassProperties
------------ --------------- ------------------
Win32_Process {Create, Terminate, Get...} {Caption, Description, InstallDate, Name...}

The Class object describes the capabilities of that class. By default, Get-CimClass lists classes from the rootcimv2 namespace.

The Namespace parameter will fill using tab completion; that is, if the following partial command is entered, pressing Tab repeatedly will cycle through the possible root namespaces:

Get-CimClass -Namespace <tab, tab, tab> 

The child namespaces of a given namespace are listed in a __Namespace class instance. For example, the following command returns the namespaces under root:

Get-CimInstance __Namespace -Namespace root 

Extending this technique, it is possible to recursively query __Namespace to find all of the possible namespace values. Certain WMI namespaces are only available to administrative users (run as administrator); the following function may display errors for some namespaces:

function Get-CimNamespace { 
    param ( 
        $Namespace = 'root' 
    ) 
       
    Get-CimInstance __Namespace -Namespace $Namespace | ForEach-Object { 
        $childNamespace = Join-Path $Namespace $_.Name 
        $childNamespace 
 
        Get-CimNamespace -Namespace $childNamespace 
    } 
} 
Get-CimNamespace 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.19.31.73