That would actually be great and very much appreciated.

I've been down the rabbit hole a bit further and found something that may 
be of interest.

>From what I've seen from the error, Jenkins sends compound shell commands 
to the node, with "&&" as pipeline chain operator.
"&&" has the same function in Bash as well as in MS-DOS.
PowerShell Windows (up to version 5 I guess) doesn't know '&&', there you 
have to use '-and'.
However, PowerShell 7 (PowerShell Core, the open source cross-platform 
version) does implement pipeline chain operators.
See 
https://docs.microsoft.com/en-us/powershell/scripting/whats-new/what-s-new-in-powershell-70?view=powershell-7

I don't know if that will solve all of the issues with PowerShell, but it's 
definitely worth giving a shot.
I'll try it out and report back here.

On Wednesday, February 10, 2021 at 8:05:15 PM UTC+1 slide wrote:

> FYI, I started to look at this again and will hopefully have a PR soon.
>
> On Tue, Feb 9, 2021, 08:07 Slide <[email protected]> wrote:
>
>> That will cause problems, the ssh-agents-plugin is not set up to handle 
>> PowerShell as the default shell. I looked into it a while back but didn't 
>> make good progress.
>>
>> On Tue, Feb 9, 2021 at 2:45 AM Amedee Van Gasse <[email protected]> 
>> wrote:
>>
>>> FYI PowerShell is the default SSH shell on this machine.
>>>
>>> On Tuesday, February 9, 2021 at 10:27:38 AM UTC+1 Amedee Van Gasse wrote:
>>>
>>>> I got this when connecting to a Windows node, how do I fix this?
>>>>
>>>> [02/09/21 10:20:58] [SSH] SSH host key matches key seen previously for 
>>>> this host. Connection will be allowed.
>>>> [02/09/21 10:20:58] [SSH] Authentication successful.
>>>> [02/09/21 10:20:59] [SSH] The remote user's environment is:
>>>> Set-Variable : Cannot process command because of one or more missing 
>>>> mandatory parameters: Name.
>>>> At line:1 char:1
>>>> + set
>>>> + ~~~
>>>>     + CategoryInfo          : InvalidArgument: (:) [Set-Variable], 
>>>> ParameterBindingException
>>>>     + FullyQualifiedErrorId : 
>>>> MissingMandatoryParameter,Microsoft.PowerShell.Commands.SetVariableCommand
>>>>  
>>>> [02/09/21 10:21:00] [SSH] Checking java version of 
>>>> C:\Users\jenkins/jdk/bin/java
>>>> [02/09/21 10:21:01] [SSH] C:\Users\jenkins/jdk/bin/java -version 
>>>> returned 11.0.10.
>>>> [02/09/21 10:21:01] [SSH] Starting sftp client.
>>>> [02/09/21 10:21:01] [SSH] Copying latest remoting.jar...
>>>> [02/09/21 10:21:02] [SSH] Copied 1,521,553 bytes.
>>>> Expanded the channel window size to 4MB
>>>> [02/09/21 10:21:02] [SSH] Starting agent process: cd "C:\Users\jenkins" 
>>>> && C:\Users\jenkins/jdk/bin/java  -jar remoting.jar -workDir 
>>>> C:\Users\jenkins -jar-cache C:\Users\jenkins/remoting/jarCache
>>>> At line:1 char:23
>>>> + cd "C:\Users\jenkins" && C:\Users\jenkins/jdk/bin/java  -jar remoting 
>>>> ...
>>>> +                       ~~
>>>> The token '&&' is not a valid statement separator in this version.
>>>>     + CategoryInfo          : ParserError: (:) [], 
>>>> ParentContainsErrorRecordException
>>>>     + FullyQualifiedErrorId : InvalidEndOfLine
>>>>  
>>>> Agent JVM has terminated. Exit code=1
>>>> [02/09/21 10:21:02] Launch failed - cleaning up connection
>>>> [02/09/21 10:21:02] [SSH] Connection closed.
>>>> SSHLauncher{host='ec2-3-123-229-137.eu-central-1.compute.amazonaws.com', 
>>>> port=22, credentialsId='b56e65e1-beb0-4ad3-bcaa-e9c7aea3c4f8', 
>>>> jvmOptions='', javaPath='', prefixStartSlaveCmd='', 
>>>> suffixStartSlaveCmd='', 
>>>> launchTimeoutSeconds=60, maxNumRetries=10, retryWaitTime=15, 
>>>> sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.ManuallyTrustedKeyVerificationStrategy,
>>>>  
>>>> tcpNoDelay=true, trackCredentials=true}
>>>> [02/09/21 10:21:02] [SSH] Opening SSH connection to 
>>>> ec2-3-123-229-137.eu-central-1.compute.amazonaws.com:22.
>>>> [02/09/21 10:21:03] [SSH] SSH host key matches key seen previously for 
>>>> this host. Connection will be allowed.
>>>> [02/09/21 10:21:03] [SSH] Authentication successful.
>>>> [02/09/21 10:21:03] [SSH] The remote user's environment is:
>>>> Set-Variable : Cannot process command because of one or more missing 
>>>> mandatory parameters: Name.
>>>> At line:1 char:1
>>>> + set
>>>> + ~~~
>>>>     + CategoryInfo          : InvalidArgument: (:) [Set-Variable], 
>>>> ParameterBindingException
>>>>     + FullyQualifiedErrorId : 
>>>> MissingMandatoryParameter,Microsoft.PowerShell.Commands.SetVariableCommand
>>>>  
>>>> [02/09/21 10:21:04] [SSH] Checking java version of 
>>>> C:\Users\jenkins/jdk/bin/java
>>>> [02/09/21 10:21:04] [SSH] C:\Users\jenkins/jdk/bin/java -version 
>>>> returned 11.0.10.
>>>> [02/09/21 10:21:04] [SSH] Starting sftp client.
>>>> [02/09/21 10:21:04] [SSH] Copying latest remoting.jar...
>>>> Source agent hash is D866F0B482DB94F38E49B26B465D5DB5. Installed agent 
>>>> hash is D866F0B482DB94F38E49B26B465D5DB5
>>>> Verified agent jar. No update is necessary.
>>>> Expanded the channel window size to 4MB
>>>> [02/09/21 10:21:09] [SSH] Starting agent process: cd "C:\Users\jenkins" 
>>>> && C:\Users\jenkins/jdk/bin/java  -jar remoting.jar -workDir 
>>>> C:\Users\jenkins -jar-cache C:\Users\jenkins/remoting/jarCache
>>>> At line:1 char:23
>>>> + cd "C:\Users\jenkins" && C:\Users\jenkins/jdk/bin/java  -jar remoting 
>>>> ...
>>>> +                       ~~
>>>> The token '&&' is not a valid statement separator in this version.
>>>>     + CategoryInfo          : ParserError: (:) [], 
>>>> ParentContainsErrorRecordException
>>>>     + FullyQualifiedErrorId : InvalidEndOfLine
>>>>  
>>>> Agent JVM has terminated. Exit code=1
>>>> [02/09/21 10:21:10] Launch failed - cleaning up connection
>>>> [02/09/21 10:21:10] [SSH] Connection closed.
>>>> connect timed out
>>>> SSH Connection failed with IOException: "connect timed out", retrying 
>>>> in 15 seconds. There are 2 more retries left.
>>>> connect timed out
>>>> SSH Connection failed with IOException: "connect timed out", retrying 
>>>> in 15 seconds. There are 1 more retries left.
>>>> connect timed out
>>>> ERROR: Connection is not established!
>>>> java.lang.IllegalStateException: Connection is not established!
>>>> at 
>>>> com.trilead.ssh2.Connection.getRemainingAuthMethods(Connection.java:988)
>>>> at 
>>>> com.cloudbees.jenkins.plugins.sshcredentials.impl.TrileadSSHPublicKeyAuthenticator.getRemainingAuthMethods(TrileadSSHPublicKeyAuthenticator.java:88)
>>>> at 
>>>> com.cloudbees.jenkins.plugins.sshcredentials.impl.TrileadSSHPublicKeyAuthenticator.canAuthenticate(TrileadSSHPublicKeyAuthenticator.java:80)
>>>> at 
>>>> com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator.newInstance(SSHAuthenticator.java:218)
>>>> at 
>>>> com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator.newInstance(SSHAuthenticator.java:171)
>>>> at 
>>>> hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:865)
>>>> at hudson.plugins.sshslaves.SSHLauncher$1.call(SSHLauncher.java:436)
>>>> at hudson.plugins.sshslaves.SSHLauncher$1.call(SSHLauncher.java:423)
>>>> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>>>> at 
>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>>>> at 
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>>>> at java.lang.Thread.run(Thread.java:748)
>>>> [02/09/21 10:24:11] Launch failed - cleaning up connection
>>>> [02/09/21 10:24:11] [SSH] Connection closed.
>>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Jenkins Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/jenkinsci-users/c9df454f-a248-4d20-b677-52870cae84a5n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/jenkinsci-users/c9df454f-a248-4d20-b677-52870cae84a5n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>> -- 
>> Website: http://earl-of-code.com
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/c605e44c-4c74-4fd2-a43a-0dfae0666273n%40googlegroups.com.

Reply via email to