The execution policy determines how (or if) PowerShell runs scripts. By default, PowerShell execution policy is set to Restricted; that means that scripts including those you write yourself would not run.
- Make sure you change the PowerShell Execution Policy settings from the default setting to any of the following;
RemoteSigned (Recommended) - This requires scripts and configuration files downloaded from the internet are digitally signed before they can run.
AllSigned - This requires all scripts and configuration files to be digitally signed before they can run.
Unrestricted - This allows unsigned scripts and configuration files downloaded from the internet to run.
- The Execution Policy for 32 and 64 bit PowerShells are stored separately.
For example, PowerShell 1.0 installs to the directory;
%SystemRoot%\system32\windowspowershell\v1.0 - for 32-bit version, and to
%SystemRoot%\system64\windowspowershell\v1.0 - for 64-bit version.
If you are running on a 64-bit operating system, there is a 32-bit version of PowerShell and a 64-bit version of PowerShell.
The script packager is a 32-bit program, so it uses the 32-bit version of PowerShell. When you launch the script directly from PowerShell, it uses the 64-bit version of PowerShell.
Make sure both versions have the correct execution policy.