I am running a script on a remote server (windows) using Jenkins:
Invoke-Command -ComputerName myserver -ScriptBlock { D:\DeployScript\myscript.bat } -credential $Cred -ErrorAction Stop
inside this "myscript.bat" i running a psexec command:
psexec -i -h -u myserver\Administrator -p mypassword {mycommands}
how can i tell Jenkins to stop if an error occur on "myscript.bat"
(i must using Psexec because the script require interactive desktop)
Thanks!