Cannot run deploy powershell scripts due to Execution Policy

w.n.bates's Avatar

w.n.bates

31 Oct, 2018 10:57 AM

When attempting a deployment the following occurs.
This script has been digitally signed by a certificate trusted on the deployment machine. Any ideas how to fix this?
Additionally is there any way to run this script in PowerShell Core instead?

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>
  1. Support Staff 1 Posted by Ilya Finkelshte... on 01 Nov, 2018 12:53 AM

    Ilya Finkelshteyn's Avatar

    Thank you for the catch! Please try fixed agent and let us know how it goes: https://www.appveyor.com/downloads/deployment-agent/6.1.0/AppveyorD...

  2. 2 Posted by w.n.bates on 01 Nov, 2018 01:29 PM

    w.n.bates's Avatar

    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.
    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.

  3. 3 Posted by doublebeep7 on 01 Nov, 2018 04:15 PM

    doublebeep7's Avatar

    Maybe you can Set Execution Policy to bypass?

      - ps: Get-ExecutionPolicy # Show execution policy
      - ps: Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass
      - ps: Get-ExecutionPolicy # Confirm that execution policy is set to bypass.
    
    Am I missing something?
  4. Support Staff 4 Posted by Ilya Finkelshte... on 01 Nov, 2018 04:16 PM

    Ilya Finkelshteyn's Avatar

    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 Applications And Services logs in Event viewer)?

  5. Support Staff 5 Posted by Ilya Finkelshte... on 01 Nov, 2018 04:20 PM

    Ilya Finkelshteyn's Avatar

    @doublebeep7 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 w.n.bates cannot install it.

  6. 6 Posted by doublebeep7 on 01 Nov, 2018 04:26 PM

    doublebeep7's Avatar

    Ok, thanks.

  7. Support Staff 7 Posted by Ilya Finkelshte... on 07 Nov, 2018 04:07 AM

    Ilya Finkelshteyn's Avatar

    @w.n.bates: I am closing this ticket, but lease feel free to re-open (by commenting here) or ping us on twitter (as you did).

  8. Ilya Finkelshteyn closed this discussion on 07 Nov, 2018 04:07 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac