13

PowerShell's "ExecutionPolicy" allows for restricting all scripts from running, only allowing signed scripts, etc - see this article for reference.

However, if I simply do:

PowerShell -ExecutionPolicy Bypass -file MyScript.ps1

... I have effectively circumvented the configured Execution Policy anyway, and the script is successfully run (even with a completely 'Restricted' default policy configured).

What's the point in having different levels of policies available, if all I have to do is send a switch to bypass it, and it'll succeed? Am I missing somewhere that 'Bypass' won't work under specific circumstances? So far, I've not found an execution policy that wouldn't let it slip right on by anyway.

(Sincerest apologies if this were better suited for StackOverflow, but I came here first, since it deals with security policies. I've searched a while to find an answer on this, but I can't seem to find a definitive explanation.)

1
  • 1
    This is exactly where this post belongs BTW, IMO. Commented Aug 22, 2020 at 6:12

1 Answer 1

5

From here (em mine):

What is the PowerShell Execution Policy?

The PowerShell execution policy is the setting that determines which type of PowerShell scripts (if any) can be run on the system. By default it is set to "Restricted", which basically means none. However, it's important to understand that the setting was never meant to be a security control. Instead, it was intended to prevent administrators from shooting themselves in the foot

2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .