I have a Jenkins (1.493) project that uses the Jenkins PowerShell build step to execute a PowerShell script. Inside that script I want to invoke another script that is stored inside a file. I have now reduced it to the following:
Script inside Jenkins PowerShell build step:
& "\\\\stemmer.local\\sidevelopment\\cvdev\\devbase\\jenkins\\PowerShell\\Test.ps1"
Content of Test.ps1:
write-host 'Hello world!'
Whenever this Jenkins project executes, the PowerShell build step hangs indefinitely.
Things I have tried/verified so far:
Test.ps1
shows me that the Jenkins PowerShell script is being execute normally up to the point where Test.ps1
is called. Test.ps1
exists and is reachable from the build slave that executes the script. If I alter the file's name, I get the expected error message from PowerShell... &
does not help. Test.ps1
can be executed properly from the powershell itself using the same command line that is being used in the Jenkins PowerShell script. unrestricted
on my development host as well as on the Jenkins build slave. powershell.exe -InputFormat None -File "\\\\stemmer.local\\sidevelopment\\cvdev\\devbase\\jenkins\\PowerShell\\Test.ps1"
I only found few references to problems that sounded similar, but none of the approaches mentioned elsewhere did help me fix this. I am absolutely puzzled, and wondering whether someone encountered this issue before (and maybe even got a scenario like the one I have in mind running).
Thanks a lot for any input!
Volker
have you tried to set execution policy to bypass ?
Copy the script file locally, then invoke it from within the Jenkins
PowerShell
plugin - that way it works as expected.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.