Go to index

Installation

PowerShell Installation

At the time of I was writing this tutorial the latest versions of all the PowerShell editions were as listed below…

  • Windows PowerShell 5.1
  • PowerShell Core v6.2.4
  • PowerShell 7.0

By default Windows PowerShell v5.1 comes along with all latest Windows Operating Systems. And when PowerShell became a opensource and cross platform (Windows, Linux and MacOS) product PowerShell Core was released and now the latest version is PowerShell 7 which was released in the month of March' 2020.

However, you can install all the above editions side by side, that means you can’t upgrade to PowerShell Core or PowerShell from Windows PowerShell because they are not the true replacement for Windows PowerShell, however there is a compatibility module as a workaround.

By installing PowerShell 7, it will uninstall the PowerShell Core. However, Windows PowerShell remains untouched.

In this session I will walk you through the various methods to install the PowerShell on Windows 10 Operating System. Since PowerShell 7 is the latest edition, I will show you different ways to install the PowerShell 7…

From Chocolatey Package Provider

First, we will find the available PowerShell packages in the Chocolatey, to find the packages run the command below…

choco find powershell

Output:

Chocolatey v0.10.15

PowerShell 5.1.14409.20180811 [Approved]
powershell.portable 6.2.4 [Approved] Downloads cached for licensed users
powershellhere-elevated 1.0.0 [Approved]
powershell-preview 7.1.0.1 [Approved] Downloads cached for licensed users
powershell-core 7.0.0 [Approved] Downloads cached for licensed users

--- output truncated ---

So, to install the latest version of PowerShell (7.0), run the command below…

choco install powershell-core -y

However if you want to install the previous versions then you can replace the product name from the above output.

Using MSI file

Go to PowerShell GitHub  page and download the latest version of PowerShell MSI file, and install it manually by double clicking and follow the screen, or you can use MSI installer command line tool.

To install the PowerShell using MSI installer tool, open a command prompt with the elevated rights (as an administrator) then go to the path where you have downloaded the PowerShell binary, and then run the code below, which is a silent installation and enables the PS Remoting along with some other options which we will discuss in our next sessions.

msiexec.exe /package PowerShell-7.0.0-win-x64.msi /quiet ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 ENABLE_PSREMOTING=1 REGISTER_MANIFEST=1

Using One Liner

There is direct script which is located in the PowerShell GitHub repo, and there is short link enabled to it by Microsoft. So we can invoke the same from the Windows PowerShell.

Open the Windows PowerShell with elevated rights (as an administrator) and run the command below…

iex "& { $(irm '') } -UseMSI"

There some are additional switches as well that you can use along with the above command, refer to the links in the Reference section below.

That’s all, we are all set and now let’s make our hands dirty with PowerShell.


Reference

Thank you, and will see you in the next session



Go to index
Last modified: 2 October 2020