How to Change the Windows PowerShell Execution Policy?

My Windows Hub

Windows PowerShell, in simple words, is a modified version of Command prompt. Windows PowerShell runs PowerShell scripts that digs deep into your operating system and performs several system functions. Any wrong execution of the shell script can ruin your computer forever. So Powershell is required to be used with utmost care. If you are using a system shared by many users, then it’s high risk to let users access PowerShell. Hence, Windows has provided permissions to restrict the accessibility of Windows PowerShell.

The permission can be categorized into 4 divisions:
Restricted – No scripts can be run. Windows PowerShell can be used only in interactive mode.
AllSigned – Only scripts signed by a trusted publisher can be run.
RemoteSigned – Downloaded scripts must be signed by a trusted publisher before they can be run.
Unrestricted – No restrictions; all Windows PowerShell scripts can be run.
If you set the execution policy to restricted then no shell script will run and your computer cannot be misused by others. If you are the only user using your personal computer, then you can set the policy to unrestircted.

Steps To Change The PowerShell Execution Policy

1. Open Cortana and type ‘powershell’. Right click on Windows PowerShell and click ‘Run as Administrator’.

select user

2. Type the following command in Powershell and hit Enter

Set-ExecutionPolicy

select user

3. Now PowerShell will prompt you to enter a parameter. The parameter tells you what permissions to set for PowerShell.
There are four different parameters that can be set by user:

Restricted – No scripts can be run. Windows PowerShell can be used only in interactive mode.
AllSigned – Only scripts signed by a trusted publisher can be run.
RemoteSigned – Downloaded scripts must be signed by a trusted publisher before they can be run.
Unrestricted – No restrictions; all Windows PowerShell scripts can be run.

select user

4. Enter the parameter that corresponds to the permissions you want to set and tap Enter.

select user

5. Next, PowerShell will ask you to confirm. It will provide you the options. Choose the correct alternative.

select user

6. Close Windows PowerShell.
That’s all!

 

Source