HowSoftwareTech

How to allow execution of Powershell scripts

You need’run Powershell scripts on your Windows Server ? Basically, the operating system does not allow the execution of Powershell scripts.

However, this tutorial offers you a simple procedure to activate the execution of Powershell scripts.

Why are Powershell scripts not enabled?

Even if Powershell is available on Windows 10 and Windows Server script execution is disabled.

Indeed the Powershell allows actions to be carried out within the Windows system.

A bad script can therefore do a lot of harm to your server. or computer.

Some antiviruses are able to protect you against this type of script.

Powershell interface
Here is the Powershell interface available on all versions of WIndows

To authorize the scripts it is therefore necessary modify the security policy on the system.

Powershell security policies

Before modifying security policies, you must know these policies.

Restricted : It’s about the default policy, scripts are disabled

AllSigned : To run the scripts, they must be digitally signed.

RemoteSigned : Downloaded scripts must be digitally signed.

Unrestricted : Allows you to run all scripts, scripts that are not digitally signed and that are uploaded to the internet require your approval.

Bypass : It is the “open-bar” mode everything is executed, no approval from you is necessary.

So on our side we are going change the Powershell security policy to Unrestricted.

Step 1 – Open Powershell

We will open a Powershell command prompt and run it as administrator:

powershell in administrator mode
We take here Powershell and not Powershell Ise.

Step 2 – Check the current security policy

We will check what is the Powershell security policy that applies on the computer or the server.

Enter the following command:

Get-ExecutionPolicy

We should obtain the following result:

powershell security policy
Here I am in “Remote Signed” security policy.

The current policy does not allow me to run scripts.

Step 3 – Activate the Powershell Unrestricted policy

To run the Powershell scripts we are going to modify the security policy to Unrestricted. This policy is a good compromise.

To modify the policy, enter the following command in the Powsershell command prompt:

Set-ExecutionPolicy Unrestricted

You will be asked for confirmation:

Powershell Unrestricted
You must validate with the option “T”, or YES for All

Well done you have just authorized the execution of Powershell scripts on your Server !!

Now you can run the various Powershell scripts.

Why use Powershell?

When you have a soft spot for programming and computers, you may want to learn the scripting language, Powershell, step by step. You have heard of it, but you do not yet know how to use it and what can this language be used for. If you want to know more about this topic, you have come to the right place.

Learn PowerShell

When you want to develop your knowledge in this scripting language, it is quite possible to watch a PowerShell tutorial. Indeed, this scripting language makes it possible to automate all the common tasks of a computer network. Thus, by configuring the network, the PowerShell script will make it possible to update the system regularly. Thus, PowerShell makes it possible to automate tasks, with a command interpreter, a framework and a scripting language. PowerShell can be used on different operating systems, such as Windows, Mac or Linux. If you want to train yourself to create scripts, you will find on various sites specialized in the field of programming, advice and the procedure to follow to familiarize yourself with PowerShell. Like any language, this learning can take time to be fully acquired.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button

Adblock Detected

Please consider supporting us by disabling your ad blocker