Member-only story

Nidhi
Mar 8, 2019

--

Connect to Remote Windows Server using psexec from JenkinsPipeline

Please visit my website and subscribe to my YouTube channel for more articles

https://devops4solutions.com/

In this blog, we will setup how we can execute scripts which is present on the remote windows server using Jenkins job

Prerequisite

  1. Configure Jenkins agents on the windows system.
  2. Download psexec from here
  3. 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:

  1. accepteula — is required so that it wont prompt at run time to accept the connection.
  2. -w — provide the path where your script is present
  3. Full Path of file
psexec.exe \\%HOSTNAME% -u %USERNAME% -p “%PASSWORD%” -accepteula -w “E:\test” “E:\test\test.bat”

--

--

Nidhi
Nidhi

Written by Nidhi

Devops Automation Enginneer

Responses (2)