TECHDIIP

  • Tech
  • Windows
  • Powershell
  • Scripts
  • News
  • Games

PowerShell Error Execution Of Scripts Is Disabled On This System | Solution

27 January 2021 admin Leave a Comment

How To Enable Powershell Execution Policy on any windows computer for Powershell scripts to work as expected, here are the steps to how to do it.

When you run a PowerShell script and if it says “execution of scripts is disabled on this system”, what does it mean? It means the execution policy is set as restricted, let’s learn what are execution policies and how to set them for use.

Restricted

No Script either local, remote or downloaded can be executed on the system.

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

AllSigned

All scripts that run require to be digitally signed.

Set-ExecutionPolicy -ExecutionPolicy Allsigned

RemoteSigned

All remote scripts (UNC) or downloaded need to be signed.

Set-ExecutionPolicy -ExecutionPolicy Remotesigned

 Unrestricted

No signature for any type of script is required.

Set-ExecutionPolicy -ExecutionPolicy Unrestricted

Scope of new Change

LocalMachine  

The execution policy affects all users of the computer.

 CurrentUser 

The execution policy affects only the current user.

Process

The execution policy affects only the current Windows PowerShell process, to check your current execution policy, you can run Get-ExecutionPolicy and get the current policy.

Get-ExecutionPolicy

Resolution

  1. Go to Start Menu and search for “Windows PowerShell ISE”.
  2. Right click the x86 version and choose “Run as administrator”
  3. Open PowerShell as Administrator and run Set-ExecutionPolicy -Scope CurrentUser
  4. Provide RemoteSigned and press Enter
  5. Run Set-ExecutionPolicy -Scope CurrentUser
  6.  Provide Unrestricted and press Enter

Conclusion:

By default it is Restricted. To change the execution of PowerShell scripts we need to set this ExecutionPolicy either as Bypass or Unrestricted.

We can set the policy for Current User as Bypass or Unrestricted by using any of the below PowerShell commands:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -Force;

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted -Force;

Thank you for reading this article, if you have any questions please let us know.

Thank you for visiting my site, please make sure you have tested this script in our lower environment before you run in production.

Powershell

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Techdiip © 2012 - 2020 | Please Read Our

  • Privacy Policy
  • Disclaimer – User Agreement
  • About Us
  • Contact Us