Hello, how are you? You have probably tried to run scripts in PowerShell in Windows. However, you will not be able to proceed as the tool displays an error message. This message indicates that you cannot continue because there is a restriction. So, read on to find out how to enable script execution in PowerShell.
What are Scripts?
Scripts are lines of code that make up a specific function or application. They are also considered to be widely used software tools. Since they are characterized by being very practical and effective. It is a very useful tool!
What are Scripts for?
These elements can be used for multiple functions:
- Execution of a specific function for a web page.
- Web development.
- Adding a software plug-in
- Schedule automatic tasks
How to enable PowerShell Script Execution in Windows 10
Most likely, scripting in PowerShell is disabled by default. Therefore, it is necessary to make a procedure to run it. The first thing you need to do is to run PowerShell with administrator privileges. With this intention, press the Win+X combination and select the corresponding option:
Then run the following command:
set-executionpolicy unrestricted –force
This action will enable the execution of PowerShell scripts with the unrestricted policy.
Script execution policy
You can use other policies for script execution:
- Undefined which performs the same function as Unrestricted
- Allsigned which establishes that all scripts are signed.
- ByPass to avoid warnings
- Restricted disabling the execution of scripts
- RemoteSigned requires the signature of a trusted publisher when downloading scripts from the Internet.
The set-executionpolicy command
This command modifies the PowerShell execution policy. It is also part of the security policies. Consequently, we can load configuration files. For example, the PowerShell profile.
Application scopes in PowerShell
There are several areas of application of PowerShell. It is a local machine with scope for all users of the pc. Also Current User for the immediate user. Processes that affect only the current PowerShell session. Finally, there are group policy settings. For example, User Policy refers to the group policy for the current user. In addition, MachinePolicy with group policies for all users. For security reasons, it is necessary to verify the policy of each area. With this in mind, just run the following command:
Pressing Enter will display the selected information. Okay, so we have seen how to enable script execution in PowerShell. Bye!