WSManNetworkFailureDetected during Start-DscConfiguration


I’m having an issue with my DSC Configuration where running it causes a network failure. I am behind a corporate proxy calling it from outside the domain. The proxy is only used for internet (downloading files), meaning the dsc configuration should bypass the proxy. So I create CimSession to use for thje DSCConfiguration.

$options = New-CimSessionOption -ProxyType None
$session = New-CimSession -ComputerName $node -SessionOption $options -Authentication Negotiate -Credential $credential
Start-DscConfiguration -Path $Path -CimSession $session -Wait -Force -Verbose
When running the script it executes, but at some point the powershell window freezes, and it seems like its stuck and I get this output. I have to hit enter sometimes for it to respond.
VERBOSE: [SERVER1]: LCM: [ End Resource ] [[Script]EnableRabbitMQPlugins] VERBOSE: [SERVER1]: [] Consistency check completed. VERBOSE: Operation 'Invoke CimMethod' complete. VERBOSE: Time taken for configuration job to complete is 12.267 seconds WARNING: [WSManNetworkFailureDetected] The network connection to SERVER1.SomeFqdn has been interrupted. Attempting to reconnect for up to 4 minutes... WARNING: [WSManConnectionRetryAttempt] Attempting to reconnect to SERVER1.SomeFqdn ... WARNING: [WSManConnectionRetryAttempt] Attempting to reconnect to SERVER1.SomeFqdn ... WARNING: [WSManConnectionRetryAttempt] Attempting to reconnect to SERVER1.SomeFqdn ...
I tried setting New-CimSession with -ProxyType None, Auto, WinHttp, and with anything other than "None" I get: The WinRM client received an HTTP status code of 502 from the remote WS-Management service.

Any idea what it might be?

Turns out it was proxy issues that caused the WSManNetworkFailureDetected. The push server is situated in the same domain as the nodes and the proxy is only used for internet, however during configuration it executes fine at first and then near the end gets interrupted.

What I needed was to set is a bypass-list on my proxy to skip connecting over the proxy when remoting locally over the network (CimSession).

# Server1.local PS>
netsh winhttp set proxy "<proxyurl>:port" bypass-list="server2.local"

# Server2.local PS>
netsh winhttp set proxy "<proxyurl>:port" bypass-list="server1.local"

Make sure to stick to the server identification in your configuration. So if you use IP’s or FQDN in your configuration, stick to the same one here (this was important).

After this I could set the proxy type to WinHttp and changed the Authentication to default (by removing -Authentication parameter). This helps so that I still can execute Invoke-WebRequest. Meaning if I download some files during configuration, it will still work.

$options = New-CimSessionOption -ProxyType WinHttp
$session = New-CimSession -ComputerName $node -SessionOption $options -Credential $credential
Start-DscConfiguration -Path $Path -CimSession $session -Wait -Force -Verbose

Hopefully this helps someone, as it took me some time to get this working.

Awesome. Thanks a lot @nickdb for sharing the solution.