0

As part of a Jenkins build process, I'd like to run a powershell script on the target machine. The target and source machines are both running Windows Server 2016.

I have a SSH configuration set up to the target machine. I'm using the Publish Over SSH plugin for this. The first thing I noticed is that the SSH configuration seems to not respect my remote directory. I have the following for the remote directory ../../inetpub/wwwroot/MyProject/bin. I've tested this path in an SSH session outside of Jenkins and it takes me where I need to be.

However, if I run echo %CD% as the command in Exec Command, it returns C:/Users/Administrator. Also, if I try accessing anything in the path ../../inetpub/wwwroot/MyProject/bin, I get file not found issues.

I'm able to run the powershell file if I provide the full path, but I would like to have the remote directory put me in the correct directory, in case anything changes.

2
  • have you tried an absolute path instead of a relative path?
    – jayhendren
    Jan 24, 2018 at 17:08
  • Yes, but the problem is that it expects a unix style path. So I can't do C:/inetpub/wwwroot/MyProject/bin. Is there a way to specify that without the drive letter? I could create a simlink under C:\Users\Administrator, but that seems wrong. Jan 24, 2018 at 17:28

0

You must log in to answer this question.

Browse other questions tagged .