Posted By: Anonymous
I am trying to run a
cmd file that calls a PowerShell script from
cmd.exe, but I am getting this error:
Management_Install.ps1cannot be loaded because the execution of scripts is disabled on this system.
I ran this command:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
When I run
Get-ExecutionPolicy from PowerShell, it returns
PS C:UsersAdministrator> Get-ExecutionPolicy Unrestricted
C:ProjectsMicrosoft.Practices.ESBSourceSamplesManagement PortalInstallScripts> powershell .Management_Install.ps1 1
WARNING: Running x86 PowerShell…
C:ProjectsMicrosoft.Practices.ESBSourceSamplesManagement PortalInstallScriptsManagement_Install.ps1cannot be loaded because the execution of scripts is disabled on this system. Please see "
get-help about_signing" for more details.
At line:1 char:25
CategoryInfo : NotSpecified: (:) , PSSecurityException
FullyQualifiedErrorId : RuntimeException
C:ProjectsMicrosoft.Practices.ESBSourceSamplesManagement PortalInstallScripts> PAUSE
Press any key to continue . . .
The system is Windows Server 2008R2.
What am I doing wrong?
If you’re using Windows Server 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 on both hosts?
As an Administrator, you can set the execution policy by typing this into your PowerShell window:
For more information, see Using the Set-ExecutionPolicy Cmdlet.
When you are done, you can set the policy back to its default value with: