Set-ExecutionPolicy

A little while ago I casually used the snippet Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted when beginning some PowerShell code.

I've seen many articles or instructions recommend that people simply set the execution policy to unrestricted for the whole local machine. This is messy for two reasons.

  1. It requires Administrator permissions. Unsurprising, given that you're affecting policy for others users.
  2. It opens you up way more than you need to.

If all you want is to run some local scripts you're working with, setting this to your current process is enough. You don't require elevation, and only that particular shell instance is affected, minimizing risk.

Stay safe!

Tags:  powershell

Home