Two things. 1. Windows machines have a 32bit and 64bit powershell. 2. Jenkins will typically run on the 32-bit JVM which means when it invokes powershell it will invoke the 32bit version.
It sounds like you have Set-Execution Policy on the 64bit version but not 32bit. You might want to configure your Jenkins to run on 64bit as there are a few powershell cmd-lets (ClusterManager,Exchange and maybe AD) that only run on the 64bit powershell. -barrett On Thursday, December 13, 2012 2:12:36 PM UTC-5, mwpowellhtx wrote: > > This is helpful: > http://jenkins.361315.n4.nabble.com/PowerShell-plug-in-question-td1468725.html > > After that it's the usual troubleshooting script issues from different > runtime contexts. > > On Thursday, December 13, 2012 1:06:13 PM UTC-6, mwpowellhtx wrote: >> >> Hello, >> >> We've got some Windows PowerShell scripts I would like to expose >> throughout our jobs for natural house keeping steps. >> >> I've got the Set-ExecutionPolicy set appropriately and I can run scripts >> apart from Jenkins through the command line, with PowerShell (i.e. context >> menu), etc. >> >> Running through the PowerShell task doesn't work at all, it fails. I try >> as a Windows Batch Command task, the command is nothing special. >> >> powershell.exe -File "<path-to-powershell-script/>" "<arg0/>" "<arg1/>" >> >> >> However, when I run the Job I get the following error: >> >> File <path-to-powershell-script/> cannot be loaded because the execution of >> scripts is disabled on this system. Please see "get-help about_signing" for >> more details. >> >> >> Now, is the Jenkins process somehow signing the wrappers it puts around >> such scripts? We've got the execution policy set otherwise, which if it's a >> conflict, then perhaps we abandon PowerShell altogether for something more >> "conventional" like Batch or Command files. >> >> We've got the PowerShell scripts today, so obviously if I can get them to >> work, I want to do that. But if I need to rewrite them as batch files, then >> I'll do that instead. >> >> Thanks in advance.. >> >> Regards, >> >> Michael >> >