PowerShell is an awesome tool created by Microsoft that is used for automating tasks. It was launched by Microsoft in 2006 as an alternative to Command Prompt, so that users could automate batch tasks and create their own system management tools in a customized way. There are over 200 cmdlets, or single function commands that can be used within PowerShell, and it’s a really flexible framework that you can use to save yourself a whole lot of hours in the day.
Is PowerShell just for Windows OS?
If you think PowerShell is Windows-centric, then you’ve been hiding under a PowerShell-proof rock since 2016. That was the year that PowerShell Core was announced as open-source and cross-platform. You can install PowerShell on macOS, (PowerShell 7.0 or higher requires macOS 10.13 and higher), and Linux, too. While Windows PowerShell is native to Windows OS, and Microsoft only supports security updates and bug fixes – the future is firmly with PowerShell Core.
Why do I need to know which PowerShell version I’m using?
There have been many PowerShell versions since the first release back in 2006. The first release was PowerShell 1.0, suitable for Windows XP and Vista, and for Microsoft Server 2003 (those were the days). Since then, the framework has cycled through 2.0, 3.0, 4.0 and 5.0, before 5.1 was released in January 2017, which is currently the last supported Microsoft version. In 2018, PowerShell Core 6.0 was released, and more recently PowerShell 7 and next, 7.2.
New features in PowerShell 7 included:
- Parallel processing with the Parallel switch for the ForEach-Object cmdlet.
- A new error-view and the Get-Error cmdlet
- Compatibility with native Windows modules
- Ternary operation with the ?: operator and null coalescing with the ?? operator
In Version 7.2, Microsoft brought back the option to install updates via the Microsoft Updates services, which had been missing since PowerShell 6.0. It also has an option to predict what you’re typing based on your historical behavior.
As not all PowerShell versions are the same, many people need support in working out which PowerShell version they are using. We’ve therefore compiled a guide to all the ways that you can check.
Within PowerShell itself
First, use your search bar to look for the PowerShell application. Simply type in Windows PowerShell, and click on the app. You can also use a Run command, by clicking the Windows key + R and then searching for PowerShell.
A window will open, where you enter the command “$PSVersionTable”, and hit the Enter key. Below you can see the PowerShell version included in the list of information.
Additional commands that will provide your PowerShell version
There are two additional commands which you can use from within PowerShell to see which version you are running. These are:
“get-host|Select-Object”
And finally, by using “$host.version.” This option will show you your PowerShell version in a slightly different format, explaining the Major and Minor release, and the build number and revision, all separated out instead of as one single number between decimal points.
Using the registry to obtain my PowerShell version
In some cases, you might not want to use PowerShell itself to find out which version you are using. In that case, you can use the Windows Registry. First, use your search bar to open up Registry Editor. You may be prompted as to whether you want to allow the editor to make changes to your machine.
In the left-hand toolbar, there are a number of options. You want to look under Software, which is found under HKEY-LOCAL-MACHINE, or HKLM.
Next, look for Microsoft under the names of software vendors, scroll down to PowerShell, and choose the option that says 3. Then click on PowerShell Engine. You’ll get a list of information which includes the version number, as seen in the screenshot below.
Can I check my PowerShell version from remote computers?
Yes! There is a specific cmdlet that PowerShell offers so that you can check for which PowerShell version is installed on remote computers. Use the Invoke-Command snippet, which you edit from the following template:
Invoke-Command -ComputerName comp1 -ScriptBlock {$PSVersionTable.PSVersion} -Credential $cred
Just make sure to edit the computer name where we’ve written “comp1”, and the credentials under $cred.
By separating out the values with commas, you can check multiple remote remote computers at the same time, saving you valuable time and effort.
Which versions of PowerShell come preinstalled with Windows OS?
It can be helpful to see which versions of PowerShell should have come pre-installed as standard with your Windows OS. This table is a useful guide.
How do I upgrade to a newer version of PowerShell?
You can run Windows PowerShell and Powershell 7.2 on the same computer, so if you’re worried about the lack of feature parity by upgrading – you can simply keep Windows PowerShell installed, and also download PowerShell. Unfortunately, PowerShell 7 and later are not guaranteed to be backwards-compatible with all previous scripts as they are no longer Windows-native, so you’ll need to test all of your scripts before moving over totally to PowerShell 7 or 7.2. Certain modules will also need to be adapted.
If you want to download PowerShell 7, it will take the place of PowerShell Core, but it can run side by side with Windows PowerShell Version 5.2. There are a few ways to do this. One option is to run a script directly from inside PowerShell. You’ll just need to paste this cmdlet snippet into the PowerShell window, and press Enter.
iex “& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI”
You’ll be prompted to go through the PowerShell wizard and choose the settings and options you want enabled or disabled.
Another way to download PowerShell is to go to its GitHub releases page. The most recent update at the time of writing is Version 7.2.3. Scroll down, and you’ll see a list of assets, where you can simply choose the OS you want to download for.
See Atera in Action
RMM Software, PSA and Remote Access that will change the way you run your MSP Business