Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powershell ExecutionPolicy is wrong when run through VisualStudio

I am trying to run a powershell script as part of my Pre-Build on a VS2005 project. I have run

$> powershell Set-ExecutionPolicy UnRestricted 

from a command line before the build and I can run the same script from from the command line. However when the script is run as part of the Pre-Build step it fails with

The execution of scripts is disabled on this system. 
Please see “get-help about_signing” for more details. 

The script works on a co-worker's x32 XP machine, but not on my x64 Windows7 machine.

like image 296
Tom Hazel Avatar asked May 26 '11 17:05

Tom Hazel


People also ask

How do I change the execution policy in PowerShell?

To change the execution policy for LocalMachine, start PowerShell with Run as Administrator. To display the execution policies for each scope in the order of precedence, use Get-ExecutionPolicy -List . To see the effective execution policy for your PowerShell session use Get-ExecutionPolicy with no parameters.

How do I bypass ExecutionPolicy process?

Running Set-ExecutionPolicy Without Prompts By default, when you run Set-ExecutionPolicy , it will prompt you whether or not you want to change the execution policy. You can skip this prompt by adding the Force parameter to your command. Using the Force parameter will suppress all confirmation prompts.


1 Answers

Did you set the execution policy in both the 64 and 32 bit Powershell environments? Your 64 bit machine will have both, and each has it's own executionpolicy setting.

like image 95
mjolinor Avatar answered Oct 20 '22 04:10

mjolinor