OPERATING SYSTEMSOS Windows

How to turn on or off Windows PowerShell script execution


If you want to turn on or off Windows PowerShell script execution in Windows 10, follow this step by step guide. We will use the Registry Editor and Local Group Policy Editor to enable or disable this functionality.

Windows PowerShell is an essential and handy tool included in the Windows operating system. There are mainly two types of scripts – Signed by a trusted publisher and Local scripts. Local scripts are what you create on your personal computer, whereas the other one is what a trusted publisher has signed to perform a specific task.

Turn on or off Windows PowerShell script execution

To turn on or off Windows PowerShell script execution using Group Policy Editor, follow these steps-

  1. Search for gpedit.msc in the Taskbar search box.
  2. Click on Edit group policy in the search result.
  3. Go to Windows PowerShell in Computer Configuration.
  4. Double-click on Turn on Script Execution.
  5. Select the Enabled option.
  6. Choose an Execution Policy from the drop-down list.
  7. Select the Disabled option to turn off script execution.
  8. Click on Apply and OK.

Let’s check out these steps in detail.

At first, you will have to open the Local Group Policy Editor on your computer. For that, search for gpedit.msc in the Taskbar search box and click on Edit group policy in the search result. After opening this tool, navigate to the following path-

Computer Configuration > Administrative Templates > Windows Components > Windows PowerShell

In the Windows PowerShell folder, you will see a setting called Turn on Script Execution. Double-click on it and select the Enabled option.

Turn on or off Windows PowerShell script execution

After that, choose an Execution Policy from the drop-down list. You will see these three options-

  • Allow only signed scripts
  • Allow local scripts and remote signed scripts
  • Allow all scripts

If you want to turn off the script execution in Windows PowerShell, choose the Disabled option.

Either way, click on Apply and OK to save the change.

As said earlier, it is possible to make the same change using Registry Editor. Before that, it is recommended to create a System Restore point and backup all Registry files.

Enable or disable Windows PowerShell script execution using Registry

To enable or disable Windows PowerShell script execution, follow these steps-

  1. Press Win+R.
  2. Type regedit and press the Enter button.
  3. Click on the Yes button.
  4. Go to Windows inside HKLM key.
  5. Right-click on Windows > New > Key.
  6. Name it as PowerShell.
  7. Right-click on PowerShell > New DWORD (32-bit) Value.
  8. Name it as EnableScripts.
  9. Double-click on it to set the Value data as 1.
  10. Right-click PowerShell > New > String Value.
  11. Name it as ExecutionPolicy.
  12. Double-click on it to set the Value data as mentioned below.

If you want to learn more, keep reading.

To get started, press Win+R, type regedit and hit the Enter button. If you see the UAC prompt, click on the Yes button to open Registry Editor on your computer. After that, navigate to the following path-

HKEY_LOCAL_MACHINESOFTWAREPoliciesMicrosoftWindows

Right-click on Windows, select New > Key, and name it as PowerShell.

How to turn on or off Windows PowerShell script execution


You will have to create a DWORD (32-bit) Value and a String Value in the PowerShell key. For that, right-click on PowerShell > New > DWORD (32-bit) Value and name it as EnableScripts.

How to turn on or off Windows PowerShell script execution

Double-click on EnableScripts to set the Value data as or 0. If you want to enable this functionality, make it 1. Otherwise, let it be 0.

How to turn on or off Windows PowerShell script execution

Now, you will have to set the execution policy. For that, right-click on PowerShell > New > String Value, and name it as ExecutionPolicy.

How to turn on or off Windows PowerShell script execution

After that, double-click on it and enter the Value data as said below-

  • AllSigned: Allow only signed scripts
  • RemoteSigned: Allow local scripts and remote signed scripts
  • Unrestricted: Allow all scripts

How to turn on or off Windows PowerShell script execution

At last, click the OK button to save the change.

That’s all! Hope it helps.

How to turn on or off Windows PowerShell script execution

Source link

Leave a Reply

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