New-CimSession

CIM sessions are created using the New-CimSession command. The following example creates a CIM session using the current system as the computer name using WSMan as the protocol:

PS> New-CimSession -ComputerName $env:COMPUTERNAME

Id : 1
Name : CimSession1
InstanceId : bc03b547-1051-4af1-a41d-4d16b0ec0402
ComputerName : PSTEST
Protocol : WSMAN

If the computer name parameter is omitted, the protocol will be set to DCOM:

PS> New-CimSession

Id : 2
Name : CimSession2
InstanceId : 804595f4-0144-4590-990a-92b2f22f894f
ComputerName : localhost
Protocol : DCOM

New-CimSession can be used to configure operation timeout settings and whether or not an initial network test should be performed.

The protocol used by New-CimSession can be changed using New-CimSessionOption. Changing the protocol can be useful if there is a need to interact with systems where WinRM is not running or configured:

PS> New-CimSession -ComputerName $env:COMPUTERNAME -SessionOption (New-CimSessionOption -Protocol Dcom)

Id : 3
Name : CimSession3
InstanceId : 29bba117-c899-4389-b874-5afe43962a1e
ComputerName : PSTEST
Protocol : DCOM
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.255.169