How to Check Which Version of PowerShell You’re Running?
PowerShell is an indispensable tool for automating various tasks on Windows. With multiple versions of PowerShell available, knowing how to check your current version is useful for troubleshooting or understanding the features at your disposal.
There are several methods to determine the PowerShell version installed on your system. This guide will walk you through these options, so you can select the one that best fits your needs.
1. Using PSVersionTable Variable
The simplest method to find out your PowerShell version is to use the PSVersionTable variable. By accessing this variable in a PowerShell window, the current version will be displayed.
- Open a PowerShell window by searching for it in the Start Menu.
- Type $PSVersionTable into the PowerShell window and press Enter.
- Look for a table that appears, listing details including the PowerShell version.
2. Find PowerShell 7 Version
PowerShell 7, the latest version, introduces enhancements over the traditional Windows PowerShell, which is based on PowerShell 5.1.
- Begin by opening the Start Menu and searching for PowerShell 7. Open it.
- The first line in the PowerShell window will indicate the exact version.
- If that isn’t successful, employ the $PSVersionTable variable to find the version.
3. Using get-host Command
The get-host command is another means to identify the PowerShell version from within a PowerShell window. It retrieves information about the program hosting the PowerShell environment.
- Launch a PowerShell window by searching for it in the Start Menu.
- In the PowerShell window, type get-host and press Enter.
- The ‘Version’ information will specify the version of the PowerShell program.
4. Using $Host Variable
Yet another approach to reveal the PowerShell version is by using the $host variable, which is automatically initialized upon starting a PowerShell session.
This method provides the added advantage of displaying the version in terms of major and minor release numbers, as well as the build version. This detail can be particularly useful for troubleshooting issues in PowerShell.
- Access the Start Menu and search for PowerShell. Open it.
- In the PowerShell prompt, type $host.version and press Enter.
5. Check the PowerShell Version in the Windows Registry
You can also find the PowerShell version by invoking the Windows Registry. Note that the registry path may vary depending on the major version of PowerShell.
Both PowerShell 7 and 5.1 have their own respective registry directories. Here are the paths for each, but remember that future versions may have different locations.
- First, open the Run dialog by pressing Win key + R on your keyboard.
- Enter regedit in the Run dialog and press Enter.
- To find the PowerShell 5.1 version, go to:
Computer > HKEY_LOCAL_MACHINE > SOFTWARE > Microsoft > PowerShell > 3 > PowerShellEngine
- In the right pane, the PowerShellVersion key will display the exact version.
- PowerShell 7 is found at:
Computer > HKEY_LOCAL_MACHINE > SOFTWARE > Microsoft > PowerShellCore > InstalledVersions
- Select the UUID (Universally Unique Identifier) on the left inside the InstalledVersions directory.
- The SemanticVersion key will reveal the precise version of PowerShell 7.
Updating PowerShell
PowerShell typically receives updates through the standard Windows update process. As such, to ensure your PowerShell remains current, be vigilant in applying regular Windows updates.
Moreover, PowerShell 7 does not come pre-installed with Windows installations and must be manually installed from the official GitHub repository should you wish to utilize it on your system.