Change PowerShell Execution Policy in Windows 11 or 10

Stefan
Change PowerShell Execution Policy in Windows 11 or 10

If you work a lot with PowerShell scripts, changing the executable policy for PowerShell scripts is often something you need to do.

PowerShell Execution Policy is a security measure in Windows PowerShell that determines how and whether PowerShell scripts (these are files with the extension .ps1) can be executed on a system. It is essentially a setting that helps determine which scripts are allowed to run and under what conditions.

There are different types of execution policies:

  1. Restricted: This is the default setting. Scripts are not allowed to run.
  2. AllSigned: All scripts must be digitally signed by a trusted publisher before they can be run. This also applies to scripts that you have written yourself.
  3. RemoteSigned: Scripts downloaded from the Internet must be digitally signed by a trusted publisher. Scripts created locally can be run without a digital signature.
  4. Unrestricted: All scripts can be run, regardless of where they come from or whether they are signed. However, if a script comes from the Internet, you will be warned before it is executed.
  5. Bypass: No warnings are given and no questions are asked. All scripts are executed without any restrictions.
  6. undefined: No execution policy is set on the current scope.

These policies are intended to prevent unwanted or malicious scripts from running automatically, which improves computer security.

Change PowerShell Execution Policy in Windows 11 or 10

To find out which PowerShell policy is currently active, you can run the following command in PowerShell.

get-executionpolicy

get-execution-policy

You will then immediately see which policy is active. This gives an indication whether you can run scripts or not. To run remote scripts, the “RemoteSigned” policy is usually suitable. So if you see “Restricted” and no “RemoteSigned”, you cannot execute external scripts.

Read also
Convert HEIC to JPG in Windows, this is how!

You can then allow external scripts in PowerShell in two ways. The first is via the Windows 11 settings.

Via settings

  • Open the Windows 11 settings.
  • Click on “System”.
  • Click on “For developers”.
  • Click on “PowerShell”.
  • Change the option “Change the execution policy to run local PowerShell scripts without signing. Signing is required for remote scripts” to on. This changes the policy to “RemoteSigned”.

Change the execution policy to run local PowerShell scripts without signing. Signing is required for external scripts

Via PowerShell command

The second way to allow all PowerShell scripts is through PowerShell itself. You can run the following command in PowerShell:

Set-executionpolicy remotesigned

Set execution policy remotesigned

You can also apply the “Scope” if necessary. This allows you to set a policy for just you as the current user or for all users on the computer. The command then becomes:

Allow remote PowerShell scripts for current user only:

Set-executionpolicy remotesigned -scope currentuser

Allow remote PowerShell scripts only for all users:

Set-executionpolicy remotesigned -scope localmachine

Allow external PowerShell scripts only for the current PowerShell process

Set-executionpolicy remotesigned -scope process

I hope to have informed you with this. Thank you for reading!

Lees meer:


Problem solved?


Help other people too.
Share this article on a website, forum or via social media.

Join our new computer forum for questions and computer help.
Do you have a computer question?

The email address will not be published. Required fields are marked with *