PowerShell Execution Policy

  • Published
  • Posted in General
  • Updated
  • 2 mins read

PowerShell has a feature that specifies the condition under which the PowerShell loads the configuration files and run the scripts.

In plain words, they are some kind of barrier. If certain conditions are not met then the configuration files or scripts will not be executed on the system. Different policies have different restriction access. These policies are defined for security purposes.

The multiple execution policies are:

  1. All Signed
  2. Bypass
  3. Remote Signed
  4. Restricted
  5. Undefined
  6. Unrestricted

Restricted – This policy permits user commands but will not run the script.
All signed – This policy can only run scripts that are signed with a digital signature.
Bypass- In this policy nothing is blocked, and no warnings are provided.
Remote Signed– The scripts that are written on the local computers can be executed without being signed under this policy.
Undefined – No execution policy is defined in the current scope.
Unrestricted – This policy run scripts that are unsigned.

Execution policy scope

The following are the various execution policy scope:

  1. Machine Policy
  2. User Policy
  3. Process
  4. Current User
  5. Local Machine

Machine Policy – This scope sets by the group policy for all the computer users.
User Policy – This scope sets by the Group policy for the current user of a computer.
Process – This scope only affects the current session of PowerShell.
Current User – In this scope, the execution policy affects only the current scope.
Local Machine – In this scope, the execution policy affects all the users on the current computer.

Determine your current execution policy

To get the policies for current session by running the following command.

Get-Execution Policy  

or

Get-Execution Policy -list  

Change the execution policy

You can also change the execution policy as per the requirement  using the following  command.

Set-Execution Policy -Execution Policy <Policy Name>  

Pragya Verma
Data Analyst
Addend Analytics

Addend Analytics is a Microsoft Gold Partner based in Mumbai, India, and a branch office in the U.S.

Addend has successfully implemented 100+ Microsoft Power BI and Business Central projects for 100+ clients across sectors like Financial Services, Banking, Insurance, Retail, Sales, Manufacturing, Real estate, Logistics, and Healthcare in countries like the US, Europe, Switzerland, and Australia.

Get a free consultation now by emailing us or contacting us.