Powershell is a strong automation tool for Windows 10. It offers security and productivity in a single package. You can use it to create scripts which are able to change system settings and automate basic tasks. Additionally, Microsoft has made sure to design an easy-to-use command-line interface software. It offers a wide range of easy to use commands for any kind of task accomplishment on Windows.
Sometimes users can’t run Powershell coded scripts on Windows. They come across an error because of security policies of the system. The error notes “can’t be loaded because running scripts is disabled on this system.” There is a sweet workaround for this issue. After this guide, you’ll be able to run powershell script on Windows.
Set-ExecutionPolicy RemoteSigned : Run Powershell script on CMD without error
You need to workaround a security feature offered by Windows 10. First of all, you need to run Powershell in administrator mode. Go to start menu, find Powershell, right-click > More > Run as Administrator.
You need to run the following command. in order to change the security environment settings of your system.
There are different security modes related to Powershell. These modes effect the execution of a Powershell script in CMD. A few of these are as follows:
- Restricted – No script will run.
- RemoteSigned – It runs script created on the same device through CMD.
- AllSigned – Every script from anywhere signed by a trusted publisher shall work.
- Unrestricted – Every script whether signed or not-signed will work. This is a risky option when looked at from security perspective.
Once you’ve activated RemoteSigned feature, make sure you turn back to the Restricted, once you have run your desired Powershell scripts on CMD.
Assuming, now you understand, how to set the right security environment on your Windows 10 PC for running a Powershell script. Next, run the following command in order to use a script which you’ve coded already.
Normally, Visual Studio places Powershell scripts in Downloads folder of the concerned user. In my case, the username was talkofweb, yours might be different.
Running a Powershell script using CMD is easy. Windows users get can error only because their security environment doesn’t match with the script’s signatures. Furthermore, a simple command using the path of the script, runs the desired automation.