Utilizing CIM sessions
The new-cimsession
cmdlet leverages two different protocols for communication with local and remote systems. Communications to the local system leverages the Distributed Component Object Model (DCOM) protocol, and remote sessions leverage the WS-Man protocol. Remote systems will need to have port 5985
for HTTP and 5986
for HTTPS opened on their firewalls to enable proper communications over WinRM. While DCOM is the default communication protocol for a local system, you can use the - CIMSessionOptions
parameter to force WS-Man communications.
In addition to opening firewall ports, you also need to enable the WS-Management Service on the system that you are executing the commands on and the system you are remoting to as well. On most systems, this service will be set to "manual" and will not be in a running state.
The last requirement for proper communications is configuring the WinRM service. Before configuring these options, you should be aware of the security implications...