mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Give error instead of crashing if WSMan client lib not available (#4387)
This commit is contained in:
@@ -2597,7 +2597,15 @@ namespace System.Management.Automation.Remoting.Client
|
||||
#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(
|
||||
|
||||
@@ -1636,7 +1636,10 @@ All WinRM sessions connected to Windows PowerShell session configurations, such
|
||||
<data name="InvalidRoleCapabilityFileExtension" xml:space="preserve">
|
||||
<value>The provided role capability file {0} does not have the required .psrc extension.</value>
|
||||
</data>
|
||||
<data name="SSHAbruptlyTerminated" >
|
||||
<data name="SSHAbruptlyTerminated" xml:space="preserve">
|
||||
<value>The SSH transport process has abruptly terminated causing this remote session to break.</value>
|
||||
</data>
|
||||
<data name="WSManClientDllNotAvailable" xml:space="preserve">
|
||||
<value>This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.</value>
|
||||
</data>
|
||||
</root>
|
||||
|
||||
Reference in New Issue
Block a user