PowerShell by Julien

How to Set PowerShell Execution Policy on Windows 10

Execution Policy is a Windows security measure that determines whether PowerShell scripts can run on a computer. PowerShell scripts cannot run on Windows by default (even for an administrator). The security policy that controls the ability to run PowerShell scripts on Windows is called Execution Policy.

You can check the current Execution Policy value in Windows 10 using the command:

Get-ExecutionPolicy

By default in Windows 10, this parameter is set to Restricted, which prevents any PowerShell scripts from executing.

You can set one of the following values in the PowerShell Execution Policy:

  • Restricted — it is a default value. It blocks the execution of any scripts and allows only to run of interactive commands in the PowerShell console;
  • All Signed — allows execution of PowerShell scripts with a digital signature;
  • Remote Signed — allows running local scripts without a signature. A digital signature is required to run PS1 files downloaded from the Internet or received from a local network;
  • Unrestricted — any PowerShell scripts are allowed. When you run an unsigned script that was downloaded from the Internet, a confirmation prompt will appear;
  • Bypass — in this mode, nothing is blocked, and no warnings or prompts appear.

By default, the LocalMachine = Restricted policy is set at the computer level. To allow PowerShell scripts to run only in the current session, you can run the commands:

Set-ExecutionPolicy RemoteSigned –Scope Process
PowerShell

Comments