How to Change PowerShell Execution Policy (2024)

By default, PowerShell restricts you from running external scripts and commands. This is due to its default Restricted execution policy. The good thing is that changing the PowerShell’s execution policy to allow you to run scripts is easier than you think. In this tutorial, we’ll show two ways to set the execution policy in PowerShell. Let’s get started.

How to Check the Current Execution Policy

Press Start, type PowerShell, right-click on it and select Run as Administrator to open PowerShell as admin. In the PowerShell window, type Get-ExecutionPolicy and press Enter. This will display your current execution policy. In my case, the active policy is Restricted.

How to Change PowerShell Execution Policy (1)

Change Execution Policy Using Settings App

On Windows 11, you can change the execution policy using the Settings app. Here’s how:

Note: Windows 10 users can follow the second method.

Press the Windows key + I to open the Windows 11 Settings app. Once it opens, navigate to the System > For Developers page.

How to Change PowerShell Execution Policy (2)

On this page, click on the PowerShell option and turn on the “Change execution policy to allow local PowerShell scripts to run without signing. Require signing for remote scripts.” toggle. This will set the PowerShell execution policy to RemoteSigned.

How to Change PowerShell Execution Policy (3)

That’s it. You can now run external scripts and commands without errors.

Change Execution Policy Using PowerShell

Press Windows key + X and select Terminal (Admin) to open the terminal. Windows 10 users can select the Windows PowerShell (Admin) option.

How to Change PowerShell Execution Policy (4)

In the PowerShell window, execute the following command to set RemoteSigned as the default execution policy for your user account.

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

To change the execution policy for all users, use the following command instead.

Set-ExecutionPolicy RemoteSigned -Scope LocalMachine

Note: RemoteSigned is the recommended execution policy to run external scripts and commands. However, you can also set other values such as the ones listed below. If you want to learn more about them, take a look at the What Are Execution Policies? section below.

  • Restricted (default)
  • AllSigned
  • Unrestricted
  • Bypass
  • Undefined
How to Change PowerShell Execution Policy (5)

If you see a confirmation prompt, type A and press Enter to confirm the execution policy change.

To verify the policy change, execute the Get-ExecutionPolicy cmdlet again and you should see it return RemoteSigned.

How to Change PowerShell Execution Policy (6)

That is all. It is simple to change the PowerShell execution policy.

What Are Execution Policies?

Think of PowerShell’s execution policies as a set of conditions that must be met for scripts or configuration files to run. While the execution policy can prevent loading configuration files and executing scripts, it is not a security measure and can be bypassed easily, as I’ve shown above. It is there only to prevent you and others from running scripts that could be harmful.

PowerShell has six execution policies. They are as follows.

Restricted: This is the default execution policy for all Windows PCs and blocks all scripts, modules, and configuration files. However, you can run built-in PowerShell commands without any problem.

All Signed: This policy requires that all scripts (including the ones you write) and configuration files be signed by a trusted publisher. If a script is not signed by a trusted publisher at the time of execution, PowerShell will prompt you to classify the publisher as trusted or untrusted. If you choose to trust the publisher, PowerShell will execute the script or load the configuration file; otherwise, it will block it.

RemoteSigned: This is the default policy for all Windows servers. It allows you to run scripts that you’ve written yourself and those from trusted publishers. If a script or configuration file is downloaded from the internet and not signed by a trusted publisher, you may have to use the Unblock-File cmdlet to run it.

Unrestricted: This is the default policy for all non-Windows PCs. It lets you run all scripts and load configuration files without any restrictions.

Bypass: This policy is mainly intended for large-scale applications which use PowerShell as its foundation. It lets you run all scripts and load configuration files without any restrictions or warnings.

Undefined: Setting the execution policy to ‘Undefined’ means that there’s no execution policy set for the current scope. If all scopes (MachinePolicy, UserPolicy, Process, CurrentUser, and LocalMachine) are set to ‘Undefined’, the policy will revert to ‘Restricted’.

I hope this simple Windows how-to guide helped you.

If you like this article, do check how to zoom in and out in PowerShell and how to run PowerShell scripts on schedule.

Update: The tutorial was updated to include another method for Windows 11 users and update the PowerShell command to work on all systems.

How to Change PowerShell Execution Policy (2024)

References

Top Articles
Latest Posts
Article information

Author: Reed Wilderman

Last Updated:

Views: 5933

Rating: 4.1 / 5 (72 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Reed Wilderman

Birthday: 1992-06-14

Address: 998 Estell Village, Lake Oscarberg, SD 48713-6877

Phone: +21813267449721

Job: Technology Engineer

Hobby: Swimming, Do it yourself, Beekeeping, Lapidary, Cosplaying, Hiking, Graffiti

Introduction: My name is Reed Wilderman, I am a faithful, bright, lucky, adventurous, lively, rich, vast person who loves writing and wants to share my knowledge and understanding with you.