How to change execution policy in PowerShell to run scripts in Windows 11

In Windows 11, 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. So sometimes when trying to run a script on PowerShell, it will fail with the “cannot be loaded because running scripts is disabled on this system” error message.

If you are trying to run a script in Windows 11, you will need to change the execution policy for the local computer, current user, or session.

When you set a PowerShell execution policy for the local computer and current user, the information will be stored in the Registry. However, if you configure the policy for a particular session, the policy will be held in memory and then lost when you close the session. According to Microsoft, the execution policy doesn’t restrict the action. You can bypass the policy by typing the script in the command-line interface (CLI).

In this guide, we will show you how to change the execution policy to run scripts successfully on PowerShell in Windows 11.

How to change execution policy in PowerShell to run scripts in Windows 11

How to change the execution policy in PowerShell

  1. Click on the Start > search for PowerShell > select the Run as administrator option.Six easy ways to shut down a Windows 11 PC 5
  2. Type the following command to confirm the current execution policy > press Enter on the keyboard.
    Get-ExecutionPolicy

    How to change execution policy to run scripts on PowerShell in Windows 11 1

  3. Type the following command to change the PowerShell execution policy to allow scripts > press Enter on the keyboard.
    Set-ExecutionPolicy RemoteSigned

    How to change execution policy to run scripts on PowerShell in Windows 11 2

  4. Type Y > press Enter on the keyboard.How to change execution policy to run scripts on PowerShell in Windows 11 3
  5. When done, you can now execute the script again, and it should now run successfully in Windows 11.

Read more:

About the Author

I'm a passionate tech enthusiast here to break down the latest trends, gadgets, and software. Whether you're a seasoned programmer or just curious about the digital world, I aim to deliver insightful articles that are both informative and engaging.

Leave a comment