Powershell is considered an advanced tool for configuring and controlling a Windows-based system. It can be defined as a system console, a terminal or “CLI” much more advanced and complete than what was once MS-DOS or what we currently know as CMD. From it we can fully configure a computer based on Windows without having to depend on a desktop for it.
That is why it is a tool that is not aimed at a common user, but is aimed at system administrators. This is because it allows us to automate tasks both on a server and on a computer and perform different functions and tasks, having full control over the system. Along with this, this tool will also help us to control certain Microsoft applications such as SQL Server, Exchange or ISS.
What’s new in PowerShell 7
PowerShell 5, the version that is installed by default in Windows 10 and Windows 11, is a very powerful tool, and for most users more than enough. However, there is always room for improvement, especially for advanced users and developers working with these types of scripts. With the release of Windows 11, Microsoft has not updated this version, so we keep running into version 5. If we want to get the most out of it, the best thing we can do is install the most modern version, number 7 at the time of update this article, a version of PowerShell that works independently of the natively included Powershell and includes many more features.
For this reason, in the new versions of PowerShell we can find functions and features that, until now, were not available in this tool, such as:
- Pipeline Parallelism.
- New operators.
- New cmdlets (ConciseView and Get-Error).
- Notifications of new versions.
- Compatibility layers for invoking modules in implicit sessions.
- Ability to invoke resources directly from the console window.
Unless we use PowerShell regularly, it is not necessary to update it to the latest available version, since, as we have mentioned above, this application is more focused on system administrators, although not exclusively.
Update PowerShell to the latest version
When updating PowerShell to the latest version we will have the possibility to do it both manually and automatically, as we are going to tell you below.
Manual method by downloading the application
Microsoft allows us to install this new version of PowerShell as one more program, with its installer. And being an open source project, we can find all the versions of the new program in the .
Here we will find two different versions. The version «Release», that corresponds to the latest stable version of the program, and the version «Preview», more advanced but unstable. We can install the one we want, any of the two. If we do not want our equipment to present any performance or performance problems, it is best to use the Release version, since it is the final version, so, in theory, it should not cause any performance or performance problems on any managed equipment. by Windows.
Once the installer is downloaded, we execute it and we will have to follow its assistant like any other program. Of course, the installation of the new PowerShell is completely safe and free of all kinds of adware or unwanted software, for a reason its code is available on GitHub, to be completely transparent to each user.
When the installation is finished we will have the latest version of PowerShell installed on the PC.
Automatic method from command line
If we don’t want to download and install the new version manually, we can also update PowerShell from the program itself. To do this, what we must do is open a PS window with administrator permissions (otherwise the update command will not work and will return an error), and execute the following command in it:
iex “& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI”
This will automatically start downloading the latest stable version from Microsoft servers, from the same website from where we can download the installer, but in .msi format. When it is downloaded, the installer will be executed, and we will have to complete the wizard, the same as in the previous step.
When the installer finishes, we will have the latest version of PowerShell installed in our operating system. Unlike other applications, it is not necessary to restart the computer to be able to start using it.
How to use the new PowerShell
Regardless of the method we have chosen, this version acts as an independent program, so in Windows we will continue to have version 5 of it installed, together with this new version. That is, we are not upgrading from version 5 to 7, what we are doing is downloading version 7 that will work independently of version 5 included natively in both Windows 10 and Windows 11.
Run the new PowerShell
We can find the new PowerShell in the following path (by default): C > Program Files > PowerShell. To execute it, we only have to use the Windows 10 search engine, and we can see how the new version appears here, together with the classic one:
Check the new version installed
When we already have the new PowerShell installed, it will appear as “PowerShell 7» within the search engine and from the launchers that we use. However, if we want to be sure of the version we have installed, we can very easily check it by running the following command again:
Get-Host | Select Object Version
From now on, when there are new versions, the PowerShell window itself will notify us of their availability. And we can use any of the two previous methods again to install that new version.
Uninstall or remove Powershell from Windows
If we want to disable PowerShell from our computer we must perform a few simple steps. The first thing will be to access the Control Panel, for which we can use the Start menu search engine. Once we have accessed, we will click on the “Programs” tab and then on the “Activate or deactivate Windows features” function.
Next, a window called “Turn Windows features on or off” will appear. Here we must display all the options and scroll to the bottom where we will find the “Windows PowerShell” option that is marked as activated. We deactivate the box to automatically eliminate the processes linked to it and click on OK
Run batch files in PowerShell
One of the main utilities offered by both the command prompt window and PowerShell is the possibility of executing your own files in batches. Basically this means that we can create custom files with a multitude of tasks or functions that will be executed one by one, depending on our needs today. To achieve this we need the Windows tool to be perfectly up to date, as we have seen before, and to work without problems.
The first thing to know is that PowerShell works differently than the Command Prompt window. That is why the execution of certain commands in both applications is not carried out in the same way. We have the ability to run a .CMD batch file in PowerShell using the Invoke-Expression parameter. This is responsible for running the command specified below or any program on the local PC from directly in a PowerShell session.
This is something we can also use to run scripts instead of programs, or embed Invoke-Expression into scripts created in PowerShell to run programs or files from them. For you to make one, I will go to the format that we should use here, we will give you an example. Next, we are going to show you how to create and execute the softzone.cmd file that is located on drive E of the system. It is not necessary to explain that previously in this file we have already placed the commands that we want to execute in batches.
Invoke-Expression -Command “E:/softzone.cmd”
In this way, thanks to this simple command that we specify before the file path, a wide range of possibilities opens up for us in PowerShell. Its subsequent use will depend on the knowledge or experience of each in this type of project in Windows.
