Group Policy for Powershell Execution

NicholasCK 1 Reputation point
2022-06-27T00:33:47.823+00:00

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
{count} votes

2 answers

Sort by: Most helpful
  1. Amit Singh 5,306 Reputation points
    2022-06-28T06:57:09.007+00:00

    The Set-ExecutionPolicy cmdlet changes PowerShell execution policies for Windows computers. For more information, see about_Execution_Policies.

    0 comments No comments

  2. 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--

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.