Bypassing execution policy for a single script

suggest change

Often you might need to execute an unsigned script that doesn’t comply with the current execution policy. An easy way to do this is by bypassing the execution policy for that single process. Example:

powershell.exe -ExecutionPolicy Bypass -File C:\MyUnsignedScript.ps1

Or you can use the shorthand. Include -File; without it, powershell.exe treats the path as -Command:

powershell -ep Bypass -File C:\MyUnsignedScript.ps1

Other Execution Policies:

Policy Description
AllSigned Only scripts signed by a trusted publisher can be run.
Bypass No restrictions; all Windows PowerShell scripts can be run.
Default Sets the policy back to the built-in default: Restricted on Windows clients, RemoteSigned on Windows Server.
RemoteSigned Scripts downloaded from the internet must be signed by a trusted publisher before they can run. Local scripts can run unsigned.
Restricted No scripts can be run. Windows PowerShell can be used only interactively. This is the usual client default.
Undefined Removes the policy from the current scope. If every scope is Undefined, Windows clients fall back to Restricted.
Unrestricted Similar to Bypass, but unsigned scripts downloaded from the internet prompt before they run.

Group Policy can override the policy you set in a session or for CurrentUser / LocalMachine.

More information is available here.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents