I wrote a simple batch file as a PowerShell script, and I am getting errors when they run.
It's in a scripts directory in my path. This is the error I get:
Cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about-signing".
I looked in the help, but it's less than helpful.
This error might pop up simply because the Windows PowerShell is disabled. So, you can tackle the issue by tweaking a few settings as follows: Type Turn Windows Features on or off in the Start Menu search bar and select the Best match. Locate the Windows PowerShell option and click its drop-down menu.
To change the execution policy to run PowerShell scripts on Windows 10, use these steps: Open Start. Search for PowerShell, right-click the top result, and select the Run as administrator option. Type the following command to allow scripts to run and press Enter: Set-ExecutionPolicy RemoteSigned.
Press “Windows + I” to open settings and click on “Update & Security”. On the left sidebar, click “For developers”, then scroll down to the “PowerShell” subheading. Tick “change execution policy to allow local PowerShell scripts to run without signing. Require signing for remote scripts.”
It could be PowerShell's default security level, which (IIRC) will only run signed scripts.
Try typing this:
set-executionpolicy remotesigned
That will tell PowerShell to allow local (that is, on a local drive) unsigned scripts to run.
Then try executing your script again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With