If PowerShell is blocking you from running scripts, follow these steps to enable PowerShell scripts execution on Windows 10.
PowerShell is a powerful Windows automation and management tool. From the PowerShell command-line interface, you can control and automate almost any part or procedure of Windows. In fact, there are a ton of both official and community-driven PowerShell scripts out there on the internet to get work done on Windows 10. When needed, you can create your own scripts too.
Basically, a PowerShell script is nothing but a text file with a bunch of commands and file extension of ".ps1". Using the script, PowerShell can execute the commands in the file in sequential order to procedure desired results.
Considering how powerful the ability to execute scripts is, PowerShell has a built-in mechanism to block unwanted or accidental script execution. For example, when you try to execute a PowerShell script with default settings, it will show the "cannot be loaded because the execution of scripts is disabled on this system." error. To enable PowerShell scripts execution, you first need to set the proper execution policy.
If you ever need to execute PowerShell scripts, follow the steps listed below to enable PowerShell scripts on Windows 10.
Steps to Enable PowerShell Scripts Execution on Windows 10
To enable PowerShell scripts, follow the steps given below one after the other.
- Press the Windows Key to open the Start menu.
- Type "PowerShell".
- Right-click on the PowerShell result and select "Run as administrator".
- After opening the PowerShell window, execute "get-executionpolicy" to know the current execution policy.
- Chances are it will say "Restricted". This means the scripts are blocked.
- In the PowerShell window, execute the "set-executionpolicy remotesigned" command.
- Type "A" next to the confirmation message and press "Enter".
- You've changed the execution policy to enable PowerShell scripts.
That is all. From now on you can execute the scripts created directly on your machine or signed scripts download from the internet or other computers.
If you want to run unsigned scripts downloaded from the internet or other computers, you need to set the execution policy to "unrestricted". To do that, execute the "set-executionpolicy unrestricted" command in the PowerShell window.
To disable the PowerShell script execution, you can simply set the execution policy back to restricted. Just execute the "set-executionpolicy restricted" command and you are good to go.
That is all. It is that simple to enable PowerShell scripts execution in Windows 10. If you are stuck or need some help, comment below and I will try to help as much as possible.
To learn more about PowerShell execution policies, read how to change PowerShell exchange policy in Windows 10. You can also know more about running PowerShell scripts from this Microsoft TechNet article.