liveBook · Manning

CIM class

As explained in Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools

A CIM class is a Common Information Model schema type that describes a category of managed resources through defined properties and relationships.

A CIM class identifies a category of managed Windows resource and exposes properties or operations for querying and administration. Practical automation often combines several classes to assemble the required information. section 9.3

Common discovery patterns include:

  • Query Win32_OperatingSystem and Win32_ComputerSystem for operating-system and computer details. section 9.3
  • Use a discovered system-drive value to retrieve the corresponding Win32_LogicalDisk instance and its free space. section 9.3
  • Discover a Win32_ class capable of changing a service logon name and password, then test it safely. section 9.6.2

Discover before scripting

Run Get-CimInstance at the command line, inspect exact property values and output formats, test multiple queries, and record working commands before building the script. section 9.3 section 9.7

How Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools covers it

How deep it goes
Explains class selection, instances, properties, output inspection, and command testing, but defers the full discovery process.
Examples
Uses Win32_OperatingSystem, Win32_ComputerSystem, Win32_LogicalDisk, and a service-management exercise as concrete examples.
What it assumes
Assumes familiarity with running PowerShell commands while reinforcing command discovery, output interpretation, and safe testing.
What you can do after
Apply it via Get-CimInstance to discover classes, inspect outputs, and validate commands before scripting.
How it connects
Connects CIM classes with PowerShell, Get-CimInstance, instances, properties, services, and system-drive discovery.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools. The section links point to the parts of the book it draws on.