New-CimSession
Use New-CimSession to create a reusable CIM session to a remote computer for use with the CIM cmdlets.
Documentation: Microsoft Learn — PowerShell module reference
Syntax
See the command anatomy
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
New-CimSession [[-ComputerName] <string[]>] [-Credential <PSCredential>] [-Authentication <PasswordAuthenticationMechanism>] [-Name <String>] [-Port <UInt32>] [-SessionOption <CimSessionOptions>] [-OperationTimeoutSec <UInt32>] [<CommonParameters>]- Stage 1New-CimSession
-ComputerName -Credential -Authentication -Name -Port -SessionOption -OperationTimeoutSec
Try it
PowerShell example · browser support is limited.
Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.
Follow the objects
Run the command to inspect each stage.
Examples
New-CimSession -ComputerName SRV01;
Show reference output
Sample output · fictional data, shaped like the real thing
Id Name ComputerName Protocol -- ---- ------------ -------- 1 CimSession1 SRV01 WSMAN
New-CimSession -Protocol DCOM;
Show reference output
Sample output · fictional data, shaped like the real thing
Id Name ComputerName Protocol -- ---- ------------ -------- 1 CimSession1 SRV01 WSMAN
Get-CimInstance -ClassName Win32_OperatingSystem
Show reference output
Sample output · fictional data, shaped like the real thing
Caption Version ------- ------- Microsoft Windows 11 Pro 10.0.26100
Parameters
Parameter definitions:
-ComputerName-Credential-Authentication-Name-Port-SessionOption-OperationTimeoutSec
Practical use and troubleshooting
Practical scenario: Use New-CimSession when you need to create a reusable CIM session to a remote computer for use with the CIM cmdlets. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.
Common error and fix: A connection failure can come from protocol or endpoint configuration. Confirm whether the target supports WSMan or requires a deliberately configured DCOM option; check credentials and firewall policy. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.
See also: Get-CimInstance. Get-CimInstance queries instances; New-CimSession creates a reusable connection description for later CIM calls. A session object is not a hardware inventory result. Read the linked command before substituting it; similar names do not imply identical inputs or output.
Recap
New-CimSession Use New-CimSession to create a reusable CIM session to a remote computer for use with the CIM cmdlets.
Next: New-PSSession