I was at a new client, trying to run a Powershell to help build my BizTalk binding files for the BizTalk Deployment Framework,
and I got this error:
PS C:developmentAllProjects.Deployment> .GenerateMasterBindingsFromLocal.ps1
File C:developmentAllProjects.DeploymentGenerateMasterBindingsFromLocal.ps1 cannot be loaded because the execution o
f scripts is disabled on this system. Please see "get-help about_signing" for more details.
At line:1 char:38
+ .GenerateMasterBindingsFromLocal.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException
At first, I thought maybe the issue was a Group Policy, but it wasn’t. You just need to run the command below, however, it does update the registry, so if you are not running as Administrator, you get this error:
PS C:developmentAllProjects.Deployment> set-executionpolicy remotesigned
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic. Do you want to change the execution
policy?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y
Set-ExecutionPolicy : Access to the registry key 'HKEY_LOCAL_MACHINESOFTWAREMicrosoftPowerShell1ShellIdsMicrosoft
.PowerShell' is denied.
At line:1 char:20
+ set-executionpolicy <<<< remotesigned
+ CategoryInfo : NotSpecified: (:) [Set-ExecutionPolicy], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetExecutionPolicyComma
nd
When you open Powershell as Admin, then run the same command, it runs and looks like this:
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic. Do you want to change the execution
policy?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y