Set PowerShell Execution Policy As Unrestricted

PowerShell is a very capable scripting language that is provided by modern Microsoft operating systems like Windows 8, Windows 10, and Windows servers. As a capable scripting language, it can be used by both Administrators and attackers. In order to secure the PowerShell scripting environment, the Execution Policy is provided. In order to run 3rd party PowerShell scripts, the execution policy should be set as Unrestricted .

List Current Execution Policy

There are different execution policies like Unrestricted , RemoteSigned , Restricted etc. The currently active policy can be listed by using the Get-ExecutionPolicy command.

Get-ExecutionPolicy

The output is Restricted which means the current PowerShell execution policy is restricted and 3rd party scripts can not be executed.

Set Execution Policy As Unrestricted For The Current User

The command Set-ExecutionPolicy is used to change the current PowerShell execution policy. The policy name is provided as a parameter to the command Set-ExecutionPolicy. The following command sets the PowerShell execution policy as Unrestricted. In order to change the PowerShell execution policy for the current user, the option -Scope is provided with the value CurrentUser ..

Set-ExecutionPolicy -Scope CurrentUser Unrestricted

The following message is provided in order to apply the policy change.

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"): A
  • Y change execution policy for this shell.
  • A changes execution policy for the current user.
  • N does not change execution policy.
See also  Print "Hello World" In PowerShell

Set PowerShell Execution Policy Unrestricted For All Users

The PowerShell execution policy can be also set unrestricted for all users. But this operation requires Administrative privileges. So first we open the PowerShell with Administrator privileges by typing PowerShell to the Start Menu.

Powershell

Now by using the Administrative privileges PowerShell terminal execute following command.

Set-ExecutionPolicy Unrestricted

Leave a Comment