I have to create a from the ‘master’ which a batch as a specific on a slave machine.

In the following example:
The slave machine is identified as ‘my_node‘. Jenkins ‘master’ contains a username/password credential called ‘my_id‘. I pass the credentials to my batch with the variables $USER and $USERPASS

node('my_node') {
   stage("exec") {
      withCredentials([usernamePassword(credentialsId: 'my_id', usernameVariable: 'USER', passwordVariable: 'USERPASS')]) {
          "runas /savecred /user:MY_DOMAIN\$USER /password:$USERPASS "cmd""

But when I execute the pipeline, the result are the following:

C:my_workspace>runas /savecred /user:MY_DOMAIN**** /password:**** "cmd" 
Enter the password for MY_DOMAIN****: 
script returned exit code 1

It is possible to override the password prompt during the pipeline execution ?

Source link https://sqa.stackexchange.com/questions/34830/how-to-execute-bat-as-a--user-in-jenkins-pipeline


Please enter your comment!
Please enter your name here