Menu & Search

“.ps1 cannot be loaded because running scripts is disabled on this system” PowerShell Error

“.ps1 cannot be loaded because running scripts is disabled on this system” PowerShell Error

When attempting to run a PowerShell script you may receive the following error:

cdk.ps1 cannot be loaded because running scripts is disabled on this system.
For more information, see about_Execution_Policies at https://go.microsoft.com/fwlink/?LinkID=135170

cannot be loaded because running scripts is disabled on this system

This post is here to help you resolve this issue. The reason this is happening is due to the default ExecutionPolicy not allowing this action. We need to change it from Undefined to RemoteSigned or Unrestricted.

Resolution: Set Execution Policy to RemoteSigned

To resolve this “script cannot be loaded because running scripts is disabled on this system” error message:

1. Open PowerShell as Administrator.

2. Check current Execution Policies: Run Get-ExecutionPolicy

Get-ExecutionPolicy -List

3. Amend Local Execution Policy: Run Set-ExecutionPolicy.

Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy RemoteSigned
Set-ExecutionPolicy PowerShell

All should work fine after the above.

Last updated: 29/09/2022

1 Comment

  1. 4 years ago

    Thnx PeterI used to do Unrestricted (https://www.itexperience.net/fix-file-cannot-be-loaded-because-running-scripts-is-disabled-on-this-system/), but using RemoteSigned looks like a much more safe solution.
    Is it also possible to run Remote powershell scripts, that are NOT signed, by copy-pasting the source code into my own ps1 file?