The Set-ExecutionPolicy cmdlet changes PowerShell execution policies for Windows computers. For more information, see about_Execution_Policies.
Group Policy for Powershell Execution
I enabled "Turn on Script Execution" and only allow signed scripts previously.
However, I would like to set the bypass policy for one specific powershell script without changing my group policy.
Is there any way of doing so?
I have tried to using the -executionpolicy bypass -file but it doesn't work.
Windows for business Windows Server User experience PowerShell
Windows for business Windows Client for IT Pros User experience Other
2 answers
Sort by: Most helpful
-
-
Limitless Technology 39,916 Reputation points
2022-06-28T07:23:03.917+00:00 Hi NicholasCK,
Sometimes you may need to execute an unsigned script that doesn't comply with your 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:powershell -ep Bypass C:\MyUnsignedScript.ps1
------------------------------------------------------------------------------------------------------------------------------------------------------
--If the reply is helpful, please Upvote and Accept as answer--