How to Allow Windows PowerShell Policy to Execute a Script

How To Allow Windows Powershell Policy To Execute A Script

PowerShell on Windows has it own policy. When we use it to execute a script sometimes it shows an error message 'can not be loaded because running script disabled on this system'. That is happen when the execution policy is set by default to 'strict'. This is good to prevent any viruses and malwares. However, when we use our Windows computer to test a software or development process, we need to turn it off.

Windows Powershell App
Windows Powershell App

Setting Execution Policy in Windows Operating System as Administrator

To set critical feature in Windows system, we need to run application as administrator. So, we will open Windows PowerShell with this method. Here, we type any proper setting that we need, to make executable script or application, to work without any interuption. Now, we want to get execution policy status. We could get it by typing:


When we execute this command, the return is Restricted at the beginning. Only known applications and scripts to Windows whitelisted. We got benefit from this policy because nowdays, Windows Operating System getting secure more and more with this setting. When we need to change it, we could execute the following command:

Set-ExecutionPolicy [argument]

There are several argument for this command:

  • Restricted. This means that no script allowed
  • Unrestricted. This means that any scripts will be allowed after executing command with this argument
  • RemoteSigned. This means that external scripts needs to be signed. This can be default
  • AllSigned. This means that not only external but also local scripts needs to be signed by publishers that is trusted to Windows system

Depending on what argument we supply to the command, we must understand that security feature is added to keep our computer system health. So, when allowing all scripts to be executed, it must be remembered to return to its initial state as soon as testing process finished. Here, we want to allow all scripts to run:

Set-ExecutionPolicy Unrestricted

Type Y when it is done.

How to Set Execution Policy when We can not Execute it as Administrator

In a system of a computer, not all of users have privilege as administrator. There are several ways to do testing process like executing a script only for current user or for current session. However, it is rare to happen because nobody doing test on a production server. Most people doing test on their own Windows desktop computer.

I used to be a pilot, but ended up being just a mediocre writer.