Setting PowerShell Execution Policies

Microsoft doesn’t want any old tool to execute PowerShell scripts. But sometimes when we’re running a tool, we need the tool to be run in a way that violates the default execution policy. In order to facilitate this, Microsoft has also provided four levels of security for the PowerShell execution policy. These include:

  • Restricted: The default execution policy, which forces commands to be entered interactively.
  • All Signed: Only signed scripts can be run by a trusted publisher.
  • Remote Signed: Any scripts created locally can run.
  • Unrestricted: Any script can run.

To configure an execution policy interactively, simply use the Set-ExecutionPolicy command followed by the name of the execution policy you wish to use. So to run the policy as unrestricted (e.g. while you’re in the midst of a deployment), you could run the following:

Set-ExecutionPolicy Unrestricted

Once run, use the Get-ExecutionPolicy with no options to see that the execution policy is configured as desired:

Get-ExecutionPolicy

Comments are closed.