AppVeyor deployment agent unable to import-module 'agent-api.psm1'.

sebastian's Avatar

sebastian

25 Jun, 2015 08:43 AM

Heya,

FYI, I encountered this error running a deployment for one of our projects using the AppVeyor agent:

Import-Module : File C:\Program Files\AppVeyor\DeploymentAgent\agent-api.psm1 cannot be loaded. The file C:\Program Files\AppVeyor\DeploymentAgent\agent-api.psm1 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.
At line:48 char:1
+ Import-Module 'C:\Program Files\AppVeyor\DeploymentAgent\agent-api.psm1'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [Import-Module], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ImportModuleCommand
You can view the deployment here:
https://ci.appveyor.com/project/Martaver/neway-webfreight/deploymen...

The server's execution policy is set to 'Unrestricted' (meaning when I start powershell and run 'get-executionpolicy' it says Unrestricted), so I think it might be a problem with the session that the AppVeyor Agent sets up for itself.

The problem disappeared the second time I ran the deployment.

  1. Support Staff 1 Posted by Feodor Fitsner on 25 Jun, 2015 02:23 PM

    Feodor Fitsner's Avatar

    What OS is that? Does agent service run under LocalService or a different account?

  2. 2 Posted by sebastian on 25 Jun, 2015 02:42 PM

    sebastian's Avatar

    WIN2K12 R2... Runs under Local System account.

  3. Support Staff 3 Posted by Feodor Fitsner on 25 Jun, 2015 10:47 PM

    Feodor Fitsner's Avatar

    Have you tried switching agent service to use administrator credentials instead of Local System?

  4. Support Staff 4 Posted by Feodor Fitsner on 25 Jun, 2015 11:44 PM

    Feodor Fitsner's Avatar

    OK, try this one: http://www.appveyor.com/downloads/3.0.5/AppveyorDeploymentAgent.msi - it should work now.

    Let me know about your results.

  5. 5 Posted by sebastian on 26 Jun, 2015 06:10 AM

    sebastian's Avatar

    Okay, I've installed it. I'll let you know if I see any more issues!

    Thanks!

  6. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:57 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