Windows 11 change PowerShell execution policy

Windows 11 change PowerShell execution policy

  • To change the PowerShell execution policy, open PowerShell (admin) and run the “Set-ExecutionPolicy RemoteSigned” command to set execution to allow scripts. The “Set-ExecutionPolicy AllSigned” command allows scripts from trusted publishers. Or the “Set-ExecutionPolicy Unrestricted” command allows scripts without restrictions.
  • You can also run the “Set-ExecutionPolicy Restricted” to undo the changes and prevent scripts from running.

On Windows 11 (or 10), by default, when you try to run a script on PowerShell, it will fail with the “cannot be loaded because running scripts is disabled on this system” error message. This is because PowerShell has an “execution policy” security feature that controls how to load configuration files and run scripts to prevent malicious code from running on the system.

This guide will teach you how to change the execution policy to run scripts successfully on PowerShell on Windows 11 or 10.

To change the PowerShell execution policy on Windows 11 (or 10), use these steps:

  1. Open Start on Windows 11.

  2. Get-ExecutionPolicy
  3. Get-ExecutionPolicy -List
  4. Set-ExecutionPolicy RemoteSigned
  5. Set-ExecutionPolicy Restricted

    PowerShell change execution policy

Once you complete the steps, you can execute the script again, and it should now run successfully on Windows 11. If you no longer want to allow scripts to run on your computer, you can run the optional command mentioned in the steps.

https://youtube.com/watch?v=PXwltlq6YhU%3Fversion%3D3%26rel%3D1%26showsearch%3D0%26showinfo%3D1%26iv_load_policy%3D1%26fs%3D1%26hl%3Den-US%26autohide%3D2%26wmode%3Dtransparent

On Windows 11, you can choose from four different execution policies to allow or deny scripts:

  • Restricted — blocks any script file from running.
  • RemoteSigned — allows scripts to be created on the computer. However, scripts created on another device won’t run without a trusted signature.
  • AllSigned — allows all scripts to run. However, only if a trusted publisher has included a signature.
  • Unrestricted — runs any script without restrictions.

You don’t need to change the execution policy if you need to run a script that does not have the required parameters and does not return output. Instead, you can use the PowerShell.exe -File "FILENAME" -ExecutionPolicy Bypass command to bypass the restrictions.

Avatar for Mauro Huculak