How to Solve Error Message PowerShell requires an execution policy in [Unrestricted, RemoteSigned, ByPass] to run command.
Basically, this is an article where the main focus is just to solve a certain error message which appear. Specifically, the error message appear upon executing a certain command. That command is just a normal command for installing a certain tool. The execution of the command is actually exist in a Power Shell tool available in a host or device running using Microsoft Windows operating system. Actually, the error will appear upon installing ‘Scoop’ as in ‘How to Install Scoop in Microsoft Windows‘ or ‘Snyk’ as in ‘How to Install Snyk in Microsoft Windows‘ and also ‘PostgREST’ as in ‘How to Install PostgREST in Microsoft Windows‘.
Table of Contents
- Introduction
- Solve Error Message PowerShell requires an execution policy in [Unrestricted, RemoteSigned, ByPass] to run command.
- Test the Solution in Microsoft Windows
Introduction
Before going on for solving the problem or the error message, below are the descriptions where the error message actually appear. The first one appeared upon installing ‘Scoop’ tool as it exist in ‘How to Install Scoop in Microsoft Windows‘ :
Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows PS C:\Users\Personal> iwr -useb get.scoop.sh | iex Initializing... PowerShell requires an execution policy in [Unrestricted, RemoteSigned, ByPass] to run Scoop. For example, to set the execution policy to 'RemoteSigned' please run 'Set-ExecutionPolicy RemoteSigned -Scope CurrentUser'. Abort. PS C:\Users\Personal>
The above is the failure for installing ‘Scoop’ tool. Another one is the failing of the installation of ‘Snyk’ as follows : where the
Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows PS C:\Users\Personal> scoop install snyk PowerShell requires an execution policy in [Unrestricted, RemoteSigned, ByPass] to run Scoop. For example, to set the execution policy to 'RemoteSigned' please run 'Set-ExecutionPolicy RemoteSigned -Scope CurrentUser'. Abort. PS C:\Users\Personal>
As for the above command also resulting in a failure for installing ‘Snyk’, it also generate the same error message. Furthermore, below is also the similar failure generating the same error message for installing ‘PostgREST’ tool as follows :
Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows PS C:\Users\Personal> scoop install postgrest PowerShell requires an execution policy in [Unrestricted, RemoteSigned, ByPass] to run Scoop. For example, to set the execution policy to 'RemoteSigned' please run 'Set-ExecutionPolicy RemoteSigned -Scope CurrentUser'. Abort. PS C:\Users\Personal>
Solve Error Message PowerShell requires an execution policy in [Unrestricted, RemoteSigned, ByPass] to run command.
Apparently, the solution for solving the problem generating the error message is quite simple. It is available as part of the output of the error message. It is exist in the following part :
PowerShell requires an execution policy in [Unrestricted, RemoteSigned, ByPass] to run Scoop. For example, to set the execution policy to 'RemoteSigned' please run 'Set-ExecutionPolicy RemoteSigned -Scope CurrentUser'. Abort.
So, the solution will be just run the command which is actually an advice to solve the problem. Below is the execution of it :
PS C:\Users\Personal> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser Execution Policy Chang The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the about_Execution_Policies help topic at https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"):
For the above process, just type ‘Y’ in order to allow executing a certain command.
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): Y PS C:\Users\Personal>
That is a command for enabling or permitting the command for being executed. Among those are installing ‘Scoop’ and also running ‘Scoop’ to install another tool such as ‘Snyk’ and ‘PostgREST’.
Test the Solution in Microsoft Windows
Actually, the solution is already exist for testing each of them in another article. It is exist for installing Scoop in ‘How to Install Scoop in Microsoft Windows‘. It also exist for installing ‘Snyk’ in ‘How to Install Snyk in Microsoft Windows‘. Furthermore, it is also exist in ‘How to Install PostgREST in Microsoft Windows‘ for installing ‘PostgREST’. Those articles presenting the solution as part of the preparation step.