CIM and WMI cmdlets let you get information about your computer and control it using simple commands.
0
0
CIM/WMI cmdlets in PowerShell
Introduction
Check your computer's hardware details like CPU or memory.
Find out which programs are running on your computer.
Get information about your network settings.
Start or stop services on your computer.
Monitor system events or errors.
Syntax
PowerShell
Get-CimInstance -ClassName <ClassName> [-ComputerName <Name>] [-Filter <Filter>] Get-WmiObject -Class <ClassName> [-ComputerName <Name>] [-Filter <Filter>]
Get-CimInstance is the newer, faster way to get info from your computer.
Get-WmiObject is older but still works on many systems.
Examples
Shows details about the operating system on your computer.
PowerShell
Get-CimInstance -ClassName Win32_OperatingSystem
Gets information about the CPU using the older WMI cmdlet.
PowerShell
Get-WmiObject -Class Win32_Processor
Lists all services that are currently running.
PowerShell
Get-CimInstance -ClassName Win32_Service -Filter "State = 'Running'"Sample Program
This script shows basic info about your operating system and lists all running services with their names.
PowerShell
Write-Output "Operating System Info:" Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object Caption, Version, OSArchitecture Write-Output "Running Services:" Get-CimInstance -ClassName Win32_Service -Filter "State = 'Running'" | Select-Object Name, DisplayName | Sort-Object Name
OutputSuccess
Important Notes
Use Get-CimInstance for better performance and newer features.
Filters help you get only the information you need, making commands faster.
Running these commands may require administrator rights depending on what info you want.
Summary
CIM/WMI cmdlets let you ask your computer about its parts and status.
Get-CimInstance is the modern way; Get-WmiObject is older but still useful.
You can filter results to see only what matters to you.