简体   繁体   中英

How execute a powershell file in a job from Jenkins?

  • Furthermore, I have the plugin for de powershell instaled.

In the configuration job, I have this:

命令窗口电源外壳

But, I have the next error when execute the job:

.ps1 cannot be loaded because the
 execution of scripts is disabled on this system. Please see "get-help about_si
gning" for more details.
At line:1 char:2
+ & <<<<  'C:\Windows\TEMP\abc.ps1'
    + CategoryInfo          : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException

Build step 'Windows PowerShell' marked build as failure
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
Finished: FAILURE

I think that this is because my instance of Jenkins not is administrator.

Note:

- I have a instance of Jenkins in my machine local
- And when I compile from my  windows power shell console, this if execute (This is possible with this instruction "Set-ExecutionPolicy Unrestricted")

You need to set the execution policy on the server. You can set the execution policy by typing this into your powershell window:

Set-ExecutionPolicy RemoteSigned

For more details https://technet.microsoft.com/en-us/library/ee176961.aspx

不要使用服务运行Jenkins服务器...在cmd窗口中运行jenkin服务器(无窗口服务)

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM