How to bypass Windows PowerShell scripts execution policies

pest_control Sympthoms
search Causes
construction Fix/Workaround/Solution

Execution policies are an important security feature on Windows, they can be applied to different scopes (as the official documentation says: “On a Windows computer you can set an execution policy for the local computer, for the current user, or for a particular session.”) and can be set up via group policies when the computer/server is domain joined.
The aim of this guide is SOLELY to make you able to quickly run a PowerShell script on your system, remember that setting up proper execution policies is mandatory to keep your OS safe.

With that being said, here are the steps to follow:
  1. (OPTIONAL) Open a PowerShell and run the following command to get a list of the system’s current execution policies:
  2. Get-ExecutionPolicy -List
  3. Open an elevated PowerShell (run as Administrator) and run the following command:
  4. Set-ExecutionPolicy Unrestricted
    Notice how we are not specifying to which scope we want to apply the “Unrestricted” policy to. That’s because if not otherwise specified the default scope is “LocalMachine“.
  5. Press Y when prompted

  6. You can now execute the script. If you still encounter problems, the problem lies somewhere else and you will need to analyze the error message to investigate the issue further.


school Further considerations

As stated before, messing around with execution policies is not recommended if you don’t have a general idea of what you’re doing, so apply this quick workaround only for the time necessary to run your scripts.
Here's a list of official Microsoft documentation on the topic that you might find useful:




Article ID: SYS-WIN-0003