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- 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- In the Windows PowerShell folder, you will see a setting called Turn on Script Execution. Double-click on it and select the Enabled option.
After that, choose an Execution Policy from the drop-down list. You will see these three options-
Allow only signed scriptsAllow local scripts and remote signed scriptsAllow 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- 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- Right-click on Windows, select New > Key, and name it as PowerShell.
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.
Double-click on EnableScripts to set the Value data as 1 or 0. If you want to enable this functionality, make it 1. Otherwise, let it be 0.
Now, you will have to set the execution policy. For that, right-click on PowerShell > New > String Value, and name it as ExecutionPolicy.
After that, double-click on it and enter the Value data as said below-
AllSigned: Allow only signed scriptsRemoteSigned: Allow local scripts and remote signed scriptsUnrestricted: Allow all scripts
At last, click the OK button to save the change. That’s all! Hope it helps.