Show
Whether you’re a PowerShell pro or just starting out, it’s useful to know how to check your PowerShell version. We’ll explain how to do that in this guide. Table of Contents
How to check your PowerShell versionLet’s quickly check the version of PowerShell installed on your device:
For more details on the different ways to check the PowerShell version, and getting the version of PowerShell installed on remote systems, keep reading! From PowerShell 1.0, to Windows PowerShell, to PowerShell v7- but which version are you using?PowerShell 1.0 was released in 2006 for the Windows operating system, including Windows XP (SP2), Windows Server 2003 (r2 SP1), and Windows Vista. It is part of the .NET framework and even comes with a graphical program called the PowerShell ISE. You can search for it in the Start menu. Searching for the PowerShell ISE in the Start MenuIn typical Microsoft fashion, there is a myriad of ways to determine what version of PowerShell you’re running. However, you should be careful in using the ‘best’ one as some methods won’t necessarily give you the accurate results you’re looking for – especially if you need to satisfy a certain requirement or prerequisite before you can run a specific command or load a certain module. But don’t worry, I’ll go through some of the basic methods and then finish with the silver bullet you should definitely keep in your PowerShell toolbelt. The Get-Host command and $host commandsThe basic ‘client-server’ dynamic that PowerShell uses is the concept of a host. A host is a program that is hosting PowerShell. You can have multiple versions of PowerShell hosts installed on a computer, so each engine of PowerShell is its own host. The main culprit for the inaccuracy of the following commands is that you can have a host that has a version that is independent of PowerShell itself. Let me show you by opening a new PowerShell window on my Windows 11 client in my Windows Server 2022 Active Directory lab environment (Hyper-V). You can also specify your PowerShell console as your default profile in Windows Terminal. The Get-Host commandYou can use the Get-Host command to get an idea of the version of PowerShell you’re running. However, again, this can be inaccurate. Get-HostUsing the Get-Host command – for now, it’s accurate… The $host and $host.Version commandsThe $host variable is an automatic variable that returns the same output as the above ‘Get-Host’ command. $host $host.VersionThe $host and $host.Version commands As you can see, the output is identical to the original commands above. Why are these two commands not always recommended?I’ll get to why these two commands are not reliable in a bit. But, let me give you a sneak preview. When I run a command on a remote computer (one of my Windows Server 2022 Domain Controllers), it does not report accurate results. Invoke-Command -ComputerName WS16-DC1 -ScriptBlock {$host.Version} -Credential $credThe $host.Version command, when run remotely, does NOT report accurate results The $PSVersionTable commandSo, remember when I was talking about a silver bullet? Well, this is it. The native command we’ll use is the PSVersionTable automatic variable that returns information specifically about the PowerShell engine version. The $PSVersionTable command not only returns the version of PowerShell, but also the ‘Edition’. Incidentally, this command will also report if you’re running PowerShell Core or PowerShell Desktop. $PSVersionTableThe $PSVersionTable command works wonderfully! How to check your PowerShell version using RegistryAs with nearly every application and feature in Windows, you can open the Registry to get configuration and version information. This includes PowerShell. You can run this command to view the PowerShellVersion registry key with the ‘Get-ItemProperty’ command. (Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine -Name 'PowerShellVersion').PowerShellVersionAccessing the Registry to determine PowerShell version information How to check the PowerShell version on remote PCsThanks to the robustness and scalability of PowerShell, you can verify the versions of PowerShell on remote computers, too. You can use the same commands as if you were locally on the remote machine. However, there are a few prerequisites you’ll want to verify on your remote machines first. The most basic is to verify Windows Management Framework (WMF) is installed and enabled. You can run the winrm quickconfig command one time on the remote machine (as an Administrator) to have Windows take care of all the checks and balances. winrm quickconfigRunning ‘winrm quickconfig’ prepares a machine to be remotely accessed via PowerShell After preparing a PC to be remotely accessed by PowerShell, here are some examples of the remote commands you can run to verify PowerShell versions. Let’s start with the Get-Host command Invoke-Command -ComputerName WS16-DC1 -ScriptBlock {Get-Host} -Credential $credChecking remote PowerShell versions isn’t accurate using these earlier commands… Again, this is one of my Windows Server 2022 DCs reporting the inaccurate version of 1.0. This is NOT correct. So, again, you’ll want to use our silver bullet remotely, too, the $PSVersionTable command. Using $PSVersionTable on remote PCsThe $PSVersionTable command, when run remotely, will accurately report the version of PowerShell running on the remote computer. Invoke-Command -ComputerName WS16-DC1 -ScriptBlock {$PSVersionTable.PSVersion} -Credential $credUsing $PSVersionTable remotely works wonderfully! How can I install the latest version of PowerShell?Again, as per typical Microsoft fashion, there are even little hints when launching PowerShell that there are better and brighter versions you could be using. Will they stop at nothing? Is nothing sacred? 😉 Microsoft ‘advertising’ later versions of PowerShell when you…launch PowerShell!So, let me give you a few methods you can use to install a more recent and secure version of PowerShell. Microsoft StoreOn Windows 10 and Windows 11, you can just open the Microsoft Store and search for PowerShell. Downloading PowerShell from the Microsoft StoreWinGetYou can use the package manager, WinGet, to download the latest version from your favorite command line/terminal. Because the winget command can download PowerShell from various repositories, (Microsoft Store (msstore) or ‘winget’), I use the ‘-s’ option to specify ‘winget.’ winget show PowerShell -s wingetDownloading the latest version of PowerShell right from the command line – No websites to browse! Information superhighwayYou can also browse Microsoft’s Docs website to download various package types of PowerShell. PowerShell for Windows Download SiteAre you looking for a macOS version? Browse here! What about Linux? You guessed it. PowerShell is cross-platform and open source. Grab the Linux version here! ConclusionI hope you learned a little bit more about PowerShell and how to determine what version of it your computer is running. You also have several avenues to download and install the latest version on your PCs, and my own preference is using winget. Please feel free to leave a comment if you have any questions or want to voice your opinions. Thank you for reading! Does Windows Server come with PowerShell?Windows PowerShell comes installed by default in every Windows, starting with Windows 7 SP1 and Windows Server 2008 R2 SP1. If you are interested in PowerShell 7 and later, you need to install PowerShell instead of Windows PowerShell.
What is the current version of PowerShell?PowerShell. What version of Windows is Server 2022 based on?Windows Server 2022 is the latest release in our Long-Term Servicing Channel (LTSC). It builds on Windows Server 2019, our fastest adopted Windows Server ever.
What version of PowerShell comes with Windows Server 2016?PowerShell and Windows versions. |