Windows PowerShell Scripts Error
search cancel

Windows PowerShell Scripts Error

book

Article ID: 3986

calendar_today

Updated On:

Products

DSERIES- SERVER CA Workload Automation DE - System Agent (dSeries)

Issue/Introduction

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

Environment

Release: DSWAHA01300-12-Workload Automation DE-High Availability
Component:

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.

 

If the version of PowerShell is unknown the following process is used to verify.

  1. Open PowerShell
  2. Run command [System.Enviornment]  Is64BitProcess  Press Enter
  3. The command will return "True" if the version being used is 64 bit 
  4. The command will return "False" if it is running 32 bit.