Technical FAQs

Ask a Question

File cannot be loaded because the execution of scripts is disabled on this system error in PowerShell

When you try to run a Powershell script (PS1), you may get the following error:

File testscript.ps1 cannot be loaded because the execution of scripts is disabled on this system.
Please see “get-help about_signing” for more details.

Product Line
StruxureWare Power Monitoring 7.2.x
Power Monitoring Expert 7.0.1
ION Enterprise 6.0.x

SQL Server 2005, SQL Server 2008 R2, SQL Server 2012, SQL Server 2014, SQL Server 2016

This error is cause by the security setting on your pc that does not allow you to execute a script. 
By default, the Execution Policy is set to Restricted. The Restricted setting means that you may not run any PS1 script at all.

To change the Execution Policy to Unrestricted, type the following command in PowerShell

Set-ExecutionPolicy Unrestricted

An overview of the policy levels:
Restricted: Individual cmdlets can run, but not saved Powershell scripts. This is the default setting.
AllSigned: Scripts can run, but must have a digital signature even if written on the local computer. Prompts you
                  before running scripts from trusted publishers.
RemoteSigned: Scripts written on the local computer do not need a digital signature, but any script downloaded
                          from outside (email, IM, Internet) must have a signature to execute.
Unrestricted: Any script can run, but scripts downloaded from outside will run with a warning.
Was this helpful?
What can we do to improve the information ?