How to solve one of the most common problems when creating your programs in PowerShell

0
19

Among the many integrated tools that the Microsoft operating system, Windows, offers us, there are some that are especially suitable for the most advanced users. Here we find, for example, CMD on the one hand, and PowerShell on the other.

We are talking about two very important functions that we find by default in the Microsoft system. Although many consider that they are the same tool, in reality this is not the case. Although they share some modes of operation, we could say that the second of the aforementioned proposals is the evolution of the first.

Hence, in these times, many users focus, when working with commands, on the use of PowerShell. Here you have the opportunity to get the most out of Windows and you can also create your own custom scripts. It is true that not everyone is qualified to carry out these tasks, but they are simpler than they might seem at first.

However, once we have made the decision to get down to work to develop our own small programs to run in PowerShell, we may encounter a basic problem. And the circumstance may occur, much more common than it seems, to execute your own or a third-party script, this tool returns an error. In fact, the error we are referring to here focuses on a failure in the execution and start-up of the small piece of software.

This basically means that the PowerShell execution policies are not configured correctly. Therefore, below we are going to show you the easiest way to modify them to be able to execute all types of scripts here.

Unlock the use of scripts in PowerShell

At this point it is important to take into account that Windows initially blocks the execution of scripts for security reasons. Less experienced users can execute malicious code here without realizing it. However, those who have enough knowledge will have to change the usage policy of the integrated tool to make their own creations work.

install-powershell

To do this, simply open a PowerShell window and run the following command here:

Set-ExecutionPolicy RemoteSigned

Actually what we do with this change is establish the functionality to allow the execution of scripts. Likewise, and if we want to activate the possibility of only executing scripts from trusted editors, we will have to use the following command:

Set-ExecutionPolicy AllSigned

On the other hand, and if we want to have greater control over the execution of this type of elements in PowerShell, we can activate the possibility of allowing scripts without restrictions. We just have to use the command that we mention now:

Set-ExecutionPolicy Unrestricted

Finally, once we have finished the work we are doing here, it may also happen that we want to return Windows to its original state. With this we want to tell you that we can configure the system to completely block the execution of these elements in PowerShell. We achieve this like this:

Set-ExecutionPolicy Restricted

To finish, we will tell you that these commands that we have told you about are valid for both Windows 10 and Windows 11.

Previous articleTor and Tails join forces to offer an Internet without censorship and privacy
Next articleThe FBI created a cryptocurrency to catch those who did bad things with it: they have arrested 18 people