Didier Stevens

Tuesday 29 August 2017

Quickpost: PowerShell Options Order

Filed under: Quickpost — Didier Stevens @ 0:00

This is a reminder for myself: “powershell.exe -File test.ps1 -ExecutionPolicy Bypass” doesn’t work.

“File C:\Demo\hello.ps1 cannot be loaded because running scripts is disabled on this system.”

It’s because of this:

-ExecutionPolicy Bypass is not parsed as an option, but as arguments to option -File.

The correct option order is this:

powershell.exe -ExecutionPolicy Bypass -File hello.ps1

 


Quickpost info


Blog at WordPress.com.