File Cannot Be Loaded Because Running Scripts Is Disabled On This System

Executing IIS (PowerShell) script using Invoke PowerShell activity has below error " Files cannot be loaded because running scripts is disabled on this system. Provide a valid certificate with which to sign the files" .

Root Cause: Restrictions of the execution policies.

Resolution: Proceed as follows,

  1. Open Powershell as an administrator
  2. Run the following commands:
  • Set-Executionpolicy Unrestricted (Remove restrictions so that all Windows PowerShell scripts can be run)
  • Set-ExecutionPolicy RemoteSigned (Downloaded scripts must be signed by a trusted publisher before they can be run)

More information here: Setting PowerShell Execution Policies

If it is not possible to change the restrictions at machine level, try at user level:

  • Set-ExecutionPolicy RemoteSigned -Scope CurrentUser