Straightaway, PowerShell is more of a developer or Sysadmin stuff and was never created for the ordinary Windows user because they have the Common Prompt to play with (ouch đ€). In short, PowerShell also runs cmdlets in addition to the Command Prompt commands. However, we arenât here to differentiate PowerShell from Command Prompt. Instead, weâll look at one Microsoft-recommended way that can tell you the PowerShell version. And though there are other methods to do it all over the internet, they wonât work every time in all situations.
Check PowerShell Version
The first thing is to open PowerShell from the Windows search. Next, type $PSVersionTable, and hit enter. This outputs important information, including the current PowerShell version, edition, compatible versions, etc. Now coming to other commands that âdonâtâ work accurately. These include get-host, $host, $host-version, etc. Notably, they give the version of the host PowerShell has been installed into and not the PowerShell engine version weâre after. However, use get-host if you have PowerShell version 1.0 since $PSVersionTable was introduced from version 2.0. So this $PSVersionTable wonât give results when used on PowerShell 1.0.
Update PowerShell in Windows Server
You can update PowerShell in the Windows server via command line scripts or downloading and install specific PowerShell versions. The simplest method is to grab the latest file from the Microsoft website or its GitHub repository and proceed with the installation. A geeky way to do this from the PowerShell itself is by running iex “& { $(irm https://aka.ms/install-powershell.ps1)} -usemsi”. This will connect to the MS GitHub repository. Next, respond to the following prompts, and the installation will be complete shortly. Notably, this wonât update the old PowerShell in the system. Instead, youâll have the updated version installed alongside.
Summing up
This completes checking the PowerShell version and how to update it. Cmdlets make PowerShell a powerful tool for automation. Still, it would help to take note of a few more scripting languages as a developer.