Screensie
← All guides

Command Line

Networked WMI Operations with PowerShell CIM

Query an authorized remote Windows computer through a CIM session.

Updated September 2, 2026Difficulty: AdvancedTime: 7 minApplies to: Windows, Windows 10, Windows 11

Follow the steps in order and stop if the screen or target does not match what is described. Use administrator access only when the task requires it.

Prepare managed remoting

The target must be authorized, reachable, and configured for Windows Remote Management with appropriate firewall and authentication policy.

Create a session

Use an explicit computer name. PowerShell can securely prompt for credentials when required.

Command
$session = New-CimSession -ComputerName PC-NAME

Run a read-only query

Pass the session to Get-CimInstance.

Command
Get-CimInstance -CimSession $session -ClassName Win32_OperatingSystem | Select-Object Caption, Version, LastBootUpTime

Query disk free space

Filter to local disks and select explicit properties.

Command
Get-CimInstance -CimSession $session -ClassName Win32_LogicalDisk -Filter "DriveType=3" | Select-Object DeviceID, Size, FreeSpace

Remove the session

Always close the session when the task is complete.

Command
Remove-CimSession -CimSession $session

Do not weaken authentication

Do not disable certificate checks, expose WinRM publicly, or add wildcard TrustedHosts entries to make a failed connection work.