Executing Powershell script that requires arguments from Jenkins pipeline Executing Powershell script that requires arguments from Jenkins pipeline powershell powershell

Executing Powershell script that requires arguments from Jenkins pipeline


Because the script is not available in the location, where you're trying to invoke the script.

Use the absolute path to invoke the script. If the path includes whitespaces use the call operator (&).

& "absolutePathToScript/script.ps1" 

I'm not hundred percent sure, but Jenkins will inject the workspace via $env:workspace (at least it will do so in normal PowerShell build steps), so you be able to invoke the script via:

& "$($env:workspace)/vars/script.ps1"


I'm just a ding dong. The Workspace was the Git repo that was getting built. I had to relocate the script to that project and it worked as expected.