How to enable PowerShell Script execution in Windows 10
Aug 19, 2021
You might be getting following error when you execute a PowerShell script:
script.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
In order to be able to execute the script, we need to turn on script execution in a group policy as follows:
- Run->gpedit.msc
- In the Local Group Policy Editor window, navigate to User Configuration\Administrative Templates\Windows Components\Windows PowerShell
- On the right side, double click on Turn On Script Execution
- Select Enable option and then in Execution Policy drop-down select suitable option. Allow all scripts could be less secure but is the most convenient option:
5. Press OK
Now try to execute the same script again, it should work.
Thanks!