Posted by Arjun Arjun on Monday 11th January 2021, 1 minute read

How to enable execution of PowerShell scripts?

The PowerShell execution policy is default set to Restricted. You can change the PowerShell execution policies with the Set-ExecutionPolicy cmdlet. Only members of the dministrators group on the computer can change the execution policy. So, Start Windows PowerShell with the "Run as Administrator" option. and run below command with the desired execution policy option. 

PS D:\pstest> Set-ExecutionPolicy RemoteSigned 
Below is the list of four different execution policies in PowerShell

  • Restricted – No scripts can be run.
  • AllSigned – Only scripts signed by a trusted publisher can be run.
  • RemoteSigned – Downloaded scripts must be signed by a trusted publisher.
  • Unrestricted – All Windows PowerShell scripts can be run
We can see the current session execution policy by running Get-ExecutionPolicy:

PS D:\pstest> Get-ExecutionPolicyRestricted
You can bypass the policy by adding -ExecutionPolicy ByPass parameter when running the PowerShell script as shown below. 

PS D:\pstest> powershell -ExecutionPolicy ByPass -File test.ps1


I am Arjun from Hyderabad (India). I have been working as a software engineer from the last 7+ years, and it is my passion to learn new things and implement them as a practice. Aside from work, I like gardening and spending time with pets.