The PowerShell execution policy is set to Restricted by default. You can change the PowerShell execution policies with the
Set-ExecutionPolicy cmdlet. Only members of the Administrators group on the computer can change the execution policy.
Start Windows PowerShell with the “Run as Administrator” option. and run the below command with the desired execution policy option.
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:
You can bypass the policy by adding -ExecutionPolicy ByPass parameter when running the PowerShell script as shown below.
I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.
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.