Member-only story
Connect to Remote Windows Server using psexec from JenkinsPipeline
Please visit my website and subscribe to my YouTube channel for more articles
In this blog, we will setup how we can execute scripts which is present on the remote windows server using Jenkins job
Prerequisite
- Configure Jenkins agents on the windows system.
- Download psexec from here
- Set the environment variable in Path.
Requirement
I want to run a script which is present on server “abc” from server “xyz” which needs credentials also to login to to that remote server.
Jenkins Server can be hosted either on linux/windows but the agent on which job needs to run should be be hosted on windows
The format of command as follows:
- accepteula — is required so that it wont prompt at run time to accept the connection.
- -w — provide the path where your script is present
- Full Path of file
psexec.exe \\%HOSTNAME% -u %USERNAME% -p “%PASSWORD%” -accepteula -w “E:\test” “E:\test\test.bat”