AppVeyor deployment agent unable to import-module 'agent-api.psm1'.
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.
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

Support Staff 1 Posted by Feodor Fitsner on 25 Jun, 2015 02:23 PM
What OS is that? Does agent service run under LocalService or a different account?
2 Posted by sebastian on 25 Jun, 2015 02:42 PM
WIN2K12 R2... Runs under Local System account.
Support Staff 3 Posted by Feodor Fitsner on 25 Jun, 2015 10:47 PM
Have you tried switching agent service to use administrator credentials instead of Local System?
Support Staff 4 Posted by Feodor Fitsner on 25 Jun, 2015 11:44 PM
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 Posted by sebastian on 26 Jun, 2015 06:10 AM
Okay, I've installed it. I'll let you know if I see any more issues!
Thanks!
Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:57 AM.