Argh! Powershell scripts have been disabled?

Just updated to the latest version to fix the NuGet/timeout bug (and the package verification bug). Unfortunately neither seem to have been helped, but more urgently it seems to have broken my deployment.

I’ve got a bunch of Powershell errors, about non-zero exit codes and that scripts have been disabled on this system. Any thoughts?!

I suppose that’ll teach me for just updating something I was relying on without checking what had changed first! Errors below:

2011-10-14 10:24:06 ERROR Deployment on the tentacle failed: Octopus.Tentacle.Integration.PowerShell.ScriptFailureException: PowerShell script ‘C:\Octopus\Tentacle\Applications\Mnetics.ManagementService.2011.10.14.1\PreDeploy.ps1’ returned non-zero exit code: Octopus.Tentacle.Integration.PowerShell.PowerShellExecutionResult. Deployment terminated.
at Octopus.Tentacle.Conventions.PowerShellConvention.AfterDeployment(ConventionContext context) in c:\TeamCity\buildAgent\work\93ea602cb1d1c3f2\source\Octopus.Tentacle\Conventions\PowerShellConvention.cs:line 59
at Octopus.Tentacle.Jobs.DeployPackageJobExecutor.Execute(DeployPackageJob job) in c:\TeamCity\buildAgent\work\93ea602cb1d1c3f2\source\Octopus.Tentacle\Jobs\DeployPackageJobExecutor.cs:line 62
at Octopus.Tentacle.Jobs.DeployPackageJobExecutor.Execute(Job job) in c:\TeamCity\buildAgent\work\93ea602cb1d1c3f2\source\Octopus.Tentacle\Jobs\DeployPackageJobExecutor.cs:line 26
at Octopus.Tentacle.Jobs.JobQueue.RunDeploymentsOnBackgroundThread(Object state) in c:\TeamCity\buildAgent\work\93ea602cb1d1c3f2\source\Octopus.Tentacle\Jobs\JobQueue.cs:line 72

2011-10-14 10:24:04 DEBUG ERROR: File C:\Octopus\Tentacle\Applications\Mnetics.ManagementService.2011.10.14.1\Pr
ERROR: eDeploy.ps1 cannot be loaded because the execution of scripts is disabled on th
ERROR: is system. Please see “get-help about_signing” for more details.
ERROR: At line:1 char:2
ERROR: + & <<<< 'C:\Octopus\Tentacle\Applications\Mnetics.ManagementService.2011.10.1
ERROR: 4.1\PreDeploy.ps1’
ERROR: + CategoryInfo : NotSpecified: (:slight_smile: [], PSSecurityException
ERROR: + FullyQualifiedErrorId : RuntimeException
ERROR:

2011-10-14 10:24:06 ERROR System.Exception: Deployment on the tentacle failed: Octopus.Tentacle.Integration.PowerShell.ScriptFailureException: PowerShell script ‘C:\Octopus\Tentacle\Applications\Mnetics.ManagementService.2011.10.14.1\PreDeploy.ps1’ returned non-zero exit code: Octopus.Tentacle.Integration.PowerShell.PowerShellExecutionResult. Deployment terminated.
at Octopus.Tentacle.Conventions.PowerShellConvention.AfterDeployment(ConventionContext context) in c:\TeamCity\buildAgent\work\93ea602cb1d1c3f2\source\Octopus.Tentacle\Conventions\PowerShellConvention.cs:line 59
at Octopus.Tentacle.Jobs.DeployPackageJobExecutor.Execute(DeployPackageJob job) in c:\TeamCity\buildAgent\work\93ea602cb1d1c3f2\source\Octopus.Tentacle\Jobs\DeployPackageJobExecutor.cs:line 62
at Octopus.Tentacle.Jobs.DeployPackageJobExecutor.Execute(Job job) in c:\TeamCity\buildAgent\work\93ea602cb1d1c3f2\source\Octopus.Tentacle\Jobs\DeployPackageJobExecutor.cs:line 26
at Octopus.Tentacle.Jobs.JobQueue.RunDeploymentsOnBackgroundThread(Object state) in c:\TeamCity\buildAgent\work\93ea602cb1d1c3f2\source\Octopus.Tentacle\Jobs\JobQueue.cs:line 72
at Octopus.Server.Deploy.PackageDeployer.PollUntilFinished(IJobService service, JobTicket ticket) in c:\TeamCity\buildAgent\work\93ea602cb1d1c3f2\source\Octopus.Server\Deploy\PackageDeployer.cs:line 50
at Octopus.Server.Deploy.DeployTaskExecutor.DeployPackagesToEnvironment(Deployment deployment, Project project, Dictionary`2 packageCache) in c:\TeamCity\buildAgent\work\93ea602cb1d1c3f2\source\Octopus.Server\Deploy\DeployTaskExecutor.cs:line 105
at Octopus.Server.Tasks.TaskQueue.<>c__DisplayClass3.b__0(Object ) in c:\TeamCity\buildAgent\work\93ea602cb1d1c3f2\source\Octopus.Server\Tasks\TaskQueue.cs:line 89

Hi Neil,

I’m sorry about this. I changed how PowerShell scripts were called to make some improvements (previously they had problems running other scripts, getting all the output back, etc.)

The solution to that issue is to open a PowerShell console as Admin on each machine and run:

Set-ExecutionPolicy Unrestricted

Again, very sorry about the release process not making this clearer, I’m working on getting release notes on the download page.

Paul

Thanks Paul, I was just about to try that when I got your email confirming that was the way to fix it.

All seems to be working again now - just a few minutes panic and not a major crisis!