diff --git a/src/System.Management.Automation/engine/remoting/fanin/WSManTransportManager.cs b/src/System.Management.Automation/engine/remoting/fanin/WSManTransportManager.cs index 2bf8b842c05..7d1d08bc263 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/WSManTransportManager.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/WSManTransportManager.cs @@ -2597,7 +2597,15 @@ internal WSManAPIDataCommon() #endif _handle = IntPtr.Zero; - ErrorCode = WSManNativeApi.WSManInitialize(WSManNativeApi.WSMAN_FLAG_REQUESTED_API_VERSION_1_1, ref _handle); + + try + { + ErrorCode = WSManNativeApi.WSManInitialize(WSManNativeApi.WSMAN_FLAG_REQUESTED_API_VERSION_1_1, ref _handle); + } + catch (DllNotFoundException) + { + throw new PSRemotingTransportException(RemotingErrorIdStrings.WSManClientDllNotAvailable); + } // input / output streams common to all connections _inputStreamSet = new WSManNativeApi.WSManStreamIDSet_ManToUn( diff --git a/src/System.Management.Automation/resources/RemotingErrorIdStrings.resx b/src/System.Management.Automation/resources/RemotingErrorIdStrings.resx index 7b21c4be9b1..5f9f5a98ed5 100644 --- a/src/System.Management.Automation/resources/RemotingErrorIdStrings.resx +++ b/src/System.Management.Automation/resources/RemotingErrorIdStrings.resx @@ -1636,7 +1636,10 @@ All WinRM sessions connected to Windows PowerShell session configurations, such The provided role capability file {0} does not have the required .psrc extension. - + The SSH transport process has abruptly terminated causing this remote session to break. + + This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system. +