Friday, April 1, 2022

[SOLVED] Jenkins: How do you SSH to a Windows VM

Issue

I am trying the following on Jenkins:

steps {
script{
    sshagent (credentials: ['creds']) {
        sh '''
            ssh -o StrictHostKeyChecking=no -tt jenkins@${IP} "
                cd
            "
        '''
    }
}

}

Obviously i am just trying to get the current directory. And as output i'm getting : [2JConnection to IP closed

Has anyone seen this before?


Solution

The issue was the -tt option, i dropped it and it worked just fine. Also, when you script windows commands like this they have to be coded in one line for some reason.



Answered By - Skouprinio
Answer Checked By - Marie Seifert (WPSolving Admin)