What is the PowerShell execution policy and why is it important?

Beginner

Answer

Execution policy is a security feature that controls which PowerShell scripts can run on a system. It helps prevent malicious scripts from executing accidentally.

Execution policy levels:

  • Restricted: No scripts can run (default on client systems)
  • RemoteSigned: Local scripts run freely; remote scripts must be signed
  • AllSigned: All scripts must be digitally signed
  • Unrestricted: All scripts run with warnings for remote scripts
  • Bypass: Nothing is blocked; no warnings
  • Undefined: No execution policy is set