-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Give error instead of crashing if WSMan client lib not available #4387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
8e4467e
to
672431e
Compare
<value>The SSH transport process has abruptly terminated causing this remote session to break.</value> | ||
</data> | ||
<data name="WSManClientDllNotAvailable" xml:space="preserve"> | ||
<value>WSMan client library is not installed</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo - skipped a point at end.
And may be add short recomendation to user how resolve the problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. It sounds like this only affects Nano. So maybe something like "WSMan client library is not installed. This parameter set requires WSMan for PowerShell remoting commands such as Invoke-Command, New-PSSession, Enter-PSSession." The problem is that SSH remoting may be available if SSH client is installed. But I don't know if that is a likely scenario.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @joeyaiello to review error message
This currently only affects Nano, but it's not something easily fixed on Nano. Basically user need to start with a different Nano image that includes WinRM. I don't think we want to put too much detail in the message as it could create more confusion particularly as @PaulHigin pointed out PSRP/SSH could still work if they have ssh.exe (which is probably more likely in the future once OpenSSH port is further along)cc @joeyaiello to review error message
This currently only affects Nano, but it's not something easily fixed on Nano. Basically user need to start with a different Nano image that includes WinRM. I don't think we want to put too much detail in the message as it could create more confusion particularly as @PaulHigin pointed out PSRP/SSH could still work if they have ssh.exe (which is probably more likely in the future once OpenSSH port is further along)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Yes I agree that the error message is fine as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about "This parameter set requires WSMan, and no WSMan client library is available. WSMan is either not installed or unavailable for this platform. It might also be possible to use SSH-based remoting instead."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joeyaiello I'm fine with everything except the last sentence as SSH may or may not be installed. I don't think we need to go to that much detail at this point. Ideally, we should just tell the user run Enable-PSRemoting
and magic happens, but that's not anytime soon.
<value>The SSH transport process has abruptly terminated causing this remote session to break.</value> | ||
</data> | ||
<data name="WSManClientDllNotAvailable" xml:space="preserve"> | ||
<value>WSMan client library is not installed</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. It sounds like this only affects Nano. So maybe something like "WSMan client library is not installed. This parameter set requires WSMan for PowerShell remoting commands such as Invoke-Command, New-PSSession, Enter-PSSession." The problem is that SSH remoting may be available if SSH client is installed. But I don't know if that is a likely scenario.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
catch (DllNotFoundException) | ||
{ | ||
throw new PSRemotingTransportException( | ||
StringUtil.Format(RemotingErrorIdStrings.WSManClientDllNotAvailable)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StringUtil.Format(..)
is unnecessary as no arguments is required for the error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will fix. lazy cut and paste :)
3e89217
to
981bdb0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine on the SSH pushback, good enough for me.
Affects NanoServer Insider build where WinRM is not available. Currently if user tries
invoke-command
, powershell crashes.Validated using:
Fix #4383