Skip to content

WMI & CIM

image.png

  1. What is CIM?
    • WMI and CIM are used to get information and control computers remotely (like processes, services, hardware).
    • CIM is newer and cross-platform, while WMI is Windows-only and older.
    • CIM (Common Information Model) = industry standard for managing computers.
    • Created by Microsoft, HP, IBM, and others.
    • Provides general models for services, processes, CPUs, disks, etc.
  2. What is WMI?
    • WMI (Windows Management Instrumentation) = Microsoft’s implementation of CIM.
    • CIM and WMI are the same standard, but different names.
  3. PowerShell Commandlets
    • WMI cmdlets → older, introduced in PowerShell 1 & 2.
    • CIM cmdlets → newer, introduced in PowerShell 3+, use CIM prefix.

  1. Protocol Differences
FeatureWMI cmdletsCIM cmdlets
ProtocolDCOM (stateful)WS-Man (stateless, HTTPS)
PortsTCP + random 1024–65534Single HTTPS port
Platform SupportWindows onlyWindows + other platforms
Output ObjectFull .NET objectSerialized object (needs Invoke-CimMethod)
Remote ConnectionOnly WMI cmdletsCIM cmdlets via WS-Man
Firewall ConfigurationRequired for multiple portsEasier, only one port

Using WMI vs CIM in PowerShell

image.png

  • WMI example:
Terminal window
Get-WmiObject -Class Win32_Process -ComputerName Server01
  • CIM example:
Terminal window
Get-CimInstance -ClassName Win32_Process -ComputerName Server01
Invoke-CimMethod -InputObject $process -MethodName Terminate

Note: CIM objects are serialized, so to run methods you use Invoke-CimMethod.


Key Advantages of CIM

  • Uses standard WS-Man protocol, easier firewall configuration.
  • Works on Windows and non-Windows platforms.
  • Microsoft recommends using CIM cmdlets; WMI cmdlets are being deprecated.
  • More consistent with PowerShell remoting.

Memory Tip:

  • WMI = Windows only, DCOM, old
  • CIM = Cross-platform, WS-Man, new, preferred
  1. CIM Sessions

    • CIM cmdlets support CIMSession → allows using different credentials and authentication methods for remote computers.
    • WMI cmdlets only use ComputerName for remote connection.
  2. Protocols

    • CIM → uses WS-Man (WinRM) by default, cross-platform.
    • Falls back to DCOM if WS-Man isn’t available.
    • WMI → uses DCOM only, Windows-only.
  3. Parallel Execution

    • CIM cmdlets support parallel processing → faster when managing multiple remote computers.
    • WMI cmdlets process computers sequentially, unless you implement parallel scripts manually.
  4. Method Execution

    • WMI → methods require parameters in a strict argument list order, easy to make mistakes.
    • CIM → allows named parameters using a hash table, simpler and clearer.

    Example:

    Terminal window
    Invoke-CimMethod -InputObject $obj -MethodName InitiateClientOperation `
    -Arguments @{ RandomizationWindow=10; TargetCollectionID="ABC"; TargetResourceIDs="X"; Type="Y" }
  5. Which to Use?

    • CIM cmdlets → preferred in most cases, modern, cross-platform, easier to use.
    • WMI cmdlets → use only for older systems (pre-Windows Server 2012) or unsupported CIM attributes.

image.png

image.png