views:

66

answers:

1

Hi Folks,

I am trying to run the a .cmd file that calls a powershell script from the command prompt and I am getting the below error:

"Management_Install.ps1 cannot be loaded because the execution of scripts is disabled on this system."

I have ran the set-executionpolicy unrestricted and when I do a get-executionpolicy from Powershell I get Unrestricted back

==========================================================================

//Output from Powershell

PS C:\Users\Administrator> get-executionpolicy

Unrestricted

//Output from Dos

C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\Install\Scr

ipts>powershell .\Management_Install.ps1 1

WARNING: Running x86 PowerShell...

File C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\Insta

ll\Scripts\Management_Install.ps1 cannot be loaded because the execution of scr

ipts is disabled on this system. Please see "get-help about_signing" for more d

etails.

At line:1 char:25

  • .\Management_Install.ps1 <<<< 1

    • CategoryInfo : NotSpecified: (:) [], PSSecurityException

    • FullyQualifiedErrorId : RuntimeException

C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\Install\Scr

ipts>pause

Press any key to continue . . .

==========================================================================

Any idea's to what I am doing wrong?

Windows Server 2008 R2 box.

Cheers

+1  A: 

If you're using Windows 2008 R2 then there is an x64 and x86 version of PowerShell both of which have to have their execution policies set. Did you set the execution policy in both hosts?

Chad Miller
Thanks Chad, yea I found I had to go to the C:\Windows\SysWOW64\WindowsPowerShell\v1.0\ powershell.exe and then set the execution policy in there along with changing my PowerShell script to look in the ProgramFiles(x86)
Conor