tag:help.appveyor.com,2012-11-13:/discussions/problems/17791-cannot-run-deploy-powershell-scripts-due-to-execution-policyAppVeyor: Discussion 2018-11-07T04:08:01Ztag:help.appveyor.com,2012-11-13:Comment/463984612018-10-31T10:57:46Z2018-10-31T15:11:22ZCannot run deploy powershell scripts due to Execution Policy<div><p>When attempting a deployment the following occurs.<br>
This script has been digitally signed by a certificate trusted on the deployment machine. Any ideas how to fix this?<br>
Additionally is there any way to run this script in PowerShell Core instead?</p>
<pre>
<code class="PowerShell">Execute before-deploy.ps1 script for MCO.Web application
File C:\Windows\TEMP\tmp8219.tmp.ps1 cannot be loaded. The file
C:\Windows\TEMP\tmp8219.tmp.ps1 is not digitally signed. You cannot run this
script on the current system. For more information about running scripts and
setting execution policy, see about_Execution_Policies at
http://go.microsoft.com/fwlink/?LinkID=135170.
+ CategoryInfo : SecurityError: (:) [], ParentContainsErrorRecord
Exception
+ FullyQualifiedErrorId : UnauthorizedAccess
Script exited with code 1
<pre><code></code>
</pre></code>
</pre></div>w.n.batestag:help.appveyor.com,2012-11-13:Comment/463984612018-11-01T00:53:33Z2018-11-01T00:53:33ZCannot run deploy powershell scripts due to Execution Policy<div><p>Thank you for the catch! Please try fixed agent and let us know how it goes: <a href="https://www.appveyor.com/downloads/deployment-agent/6.1.0/AppveyorDeploymentAgent.msi">https://www.appveyor.com/downloads/deployment-agent/6.1.0/AppveyorD...</a></p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/463984612018-11-01T13:29:27Z2018-11-01T13:29:27ZCannot run deploy powershell scripts due to Execution Policy<div><p>I can't get that one to install. I get a message at the Start service point saying it's unable to start the service and to check I have enough privileges.<br>
I found the agent-api.ps1 script in the program directory and signed that manually and it now works with the previous version of the deployment agent.</p></div>w.n.batestag:help.appveyor.com,2012-11-13:Comment/463984612018-11-01T16:15:31Z2018-11-01T16:17:24ZCannot run deploy powershell scripts due to Execution Policy<div><p>Maybe you can Set Execution Policy to bypass?<br></p>
<pre>
<code> - ps: Get-ExecutionPolicy # Show execution policy
- ps: Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass
- ps: Get-ExecutionPolicy # Confirm that execution policy is set to bypass.</code>
</pre>
Am I missing something?</div>doublebeep7tag:help.appveyor.com,2012-11-13:Comment/463984612018-11-01T16:16:42Z2018-11-01T16:16:42ZCannot run deploy powershell scripts due to Execution Policy<div><p>Good that you are unblocked, however I would understand better installation error? When you have time, can you please send an error screenshot and also if you see any errors at AppVeyor event log (located under <code>Applications And Services logs</code> in Event viewer)?</p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/463984612018-11-01T16:20:51Z2018-11-01T16:20:51ZCannot run deploy powershell scripts due to Execution Policy<div><p><strong>@doublebeep7</strong> execution policy will be set for the current logged on user, though AppVeyor Deployment agent service runs under System account. You can change log on user for AppVeyor Deployment agent service and change execution policy for that user, but this is not the best approach. Fixed agent should work correctly, problem now is why <strong>w.n.bates</strong> cannot install it.</p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/463984612018-11-01T16:26:50Z2018-11-01T16:26:50ZCannot run deploy powershell scripts due to Execution Policy<div><p>Ok, thanks.</p></div>doublebeep7tag:help.appveyor.com,2012-11-13:Comment/463984612018-11-07T04:07:59Z2018-11-07T04:07:59ZCannot run deploy powershell scripts due to Execution Policy<div><p><strong>@w.n.bates</strong>: I am closing this ticket, but lease feel free to re-open (by commenting here) or ping us on twitter (as you did).</p></div>Ilya Finkelshteyn