#powershell Missing (CIM) Module Cmdlets, etc.

Starting in PowerShell version 3.0, the preferred way is Common Information Model (CIM) over Windows Management Instrumentation (WMI) to manage Windows and other supported (Linux) platforms. Consequently, many PS CIM cmdlets expose the parameter -CimSession which represents a client-side connection to a local or remote host.

Clearly, Get-Help *-cim* reveals available CIM cmdlets but only by …
… executing the below statement can you narrow down the list supporting the said parameter. Nevertheless, you are surprised by the limited output:

Get-Command -ParameterName CimSession

CommandType Name ModuleName
———– —- ———-
Cmdlet Get-Module Microsoft.PowerShell.Core
Cmdlet Import-Module Microsoft.PowerShell.Core

This is because PS modules are dynamically loaded upon first use of a command in the respective modules. To get around this, simply run:

Import-Module (Get-Module -ListAvailable).Name

to force import of known modules* before executing gcm again.

* found in $env:PSModulepath

REFERENCES

Common Information Model
Should I use CIM or WMI with Windows PowerShell?
Introduction to CIM Cmdlets
CIM Cmdlets – Some Tips & Tricks
What is CIM and Why Should I Use It in PowerShell?

Bookmark the permalink.

Leave a Reply