How to enable PowerShell scripting in Windows 10?

If you are trying to run PowerShell scripts, you may not be able to move forward because the tool gives you an error message stating that there is a restriction. Therefore, we recommend that you read this article with which you will learn How to enable PowerShell scripting in Windows 10?

What are scripts?

Scripts are lines of code that make up one specific function or specific application. Scripts are considered computer tools widely used on the web and are characterized by being very practical and efficient.




What are scripts used for?

Scripts are used to perform multiple actions, including execution of a function specific for a web page, web development, adding a software plug-in. You can even schedule tasks like closing Word from a VBA code or script among other automated processes. In short, they are an essential element for the Internet.

<a name=How to enable PowerShell scripting in Windows 10?" src="/images/posts/1511f23fca7282430d0cff3ed9b321d7-0.jpg">

What is PowerShell?

PowerShell is a tool that allows you to administer the system and looks like a console. PowerShell is characterized by being a more advanced resource than cmd and MS-DOS which is responsible for facilitating the control of the operating system and some applications.

It is important to note that PowerShell uses a very comprehensive console language that relies on a set of mathematical operators, variables, and other elements intended for scripting. Some users choose to completely remove or uninstall Windows PowerShell when they are unaware of its usefulness. However, it is advisable to preserve the tool due to its relevance when applying various tasks.

How to enable PowerShell scripting in Windows 10?

Often, PowerShell scripting in Windows 10 is disabled by default. For this reason it is convenient enable PowerShell script execution in Windows 10 through a procedure that we explain below.




Log in to PowerShell to enable script execution

Go to the Windows 10 Start menu and type in the search engine (magnifying glass icon) "Windows PowerShell". When a blue icon appears with the window identifying the PowerShell tool, right click on it and select the option "Run as administrator".

The PowerShell command window will open, indicating the “System32” directory for “Windows”. If you are interested, you can make the Powershell window transparent. In this window you will be able to insert the lines of code necessary to perform the required actions.

Enable PowerShell scripting in Windows 10

If you try to run a script in PowerShell, you will see the message “Script execution is disabled on this system”. Therefore, you need to write this line of code: set-executionpolicy unrestricted –force and press the "Enter" key to enable the execution of PowerShell scripts on the local computer with the "unrestricted" policy.

<a name=How to enable PowerShell scripting in Windows 10?" src="/images/posts/1511f23fca7282430d0cff3ed9b321d7-1.jpg">

Criteria for running scripts

You can use others policy for running scripts such as "Undefined" which performs the same function as "Unrestricted", "Allsigned" which establishes that all scripts are signed, "ByPass" to avoid warnings, "Restricted" which disables scripting execution and "RemoteSigned" which requires the signature of a reliable editor when downloading scripts from the Internet.


The set-executionpolicy command

Set-executionpolicy changes the execution policy in Windows PowerShell. Also, this command is part of the security strategies which allow you to load configuration files such as the PowerShell profile.


Scopes in PowerShell

There are several scopes of applications in PowerShell such as: "Local Machine" with scope to all PC users, "Current User" for the current user, "Process" which affects only the current session in PowerShell, "User Policy" which establishes the policy group for the current user and "MachinePolicy" with group policies for all users.


Check which type of policy is assigned to each scope after enabling PowerShell script execution in Windows 10

To find out what type of policy is associated with each scope, type PowerShell: Get- ExecutionPolicy –list and press "Enter". Therefore, the system will show you the configuration of each of the application fields.

add a comment of How to enable PowerShell scripting in Windows 10?
Comment sent successfully! We will review it in the next few hours.