Windows PowerShell Scripts Error

Document ID : KB000003986
Last Modified Date : 14/02/2018
Show Technical Document Details
Issue:

Windows PowerShell script fails to run and reporting error... "cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about signing".

Cause:

You are getting this error because the security settings built into Windows PowerShell include something called the "execution policy".

Resolution:

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.

  1. 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.

  2. 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.