What is PowerShell?
PowerShell is a task automation and configuration management framework developed by Microsoft. It includes a command-line shell and a scripting language built on the .NET framework, later evolving to .NET Core.
PowerShell helps IT professionals automate administrative tasks and manage systems efficiently. It allows users to manage Windows operating systems, automate tasks, configure settings, and manage cloud services. Its command-line interface and scripting capabilities allow for complex operations with simple scripts.
Windows PowerShell vs. PowerShell
Windows PowerShell and the newer PowerShell (formerly PowerShell Core) have some key differences:
How to Check Powershell Version
PowerShell has gone through several updates since its creation. Different versions may offer different features, and if you’re using an older version, that may explain why you’re having trouble with certain scripts or commands.
How to Check Powershell Version in Windows 11
Have you ever wanted to know how to check what version of PowerShell you have? We’ve got you covered.
PowerShell Should Tell You the Version by Default
When you open PowerShell, it should tell you which version you’re currently using by default. It will be at the top of the window.
In this case, we use PowerShell 7.4.3, which is the latest PowerShell version at the time of writing. If you’re not using the latest version, a banner will appear at the top of the window, prompting you to update.
If, for some reason, you don’t see the version at the top of the screen, there are a few ways you can make PowerShell spit out the version for you.
$Host Variable
The $Host variable is a built-in variable in PowerShell that provides information about the current host application. You can use it to check the PowerShell version with a simple command.
All you need to do is open PowerShell and run this command:
$Host.Version
There are three parts that you need to pay attention to: Major, Minor, and Build. In our example, we see that Major is 7, Minor is 4, and Build is 3.
So, we’re using PowerShell version 7.4.3.
Get-Host cmdlet
The Get-Host cmdlet provides information about the current PowerShell host, including its version. It is a straightforward way to determine which version of PowerShell you are using.
Open PowerShell and run the following command:
Get-Host
This command will display various details about the PowerShell host, including the version. You can find the version just below the name, second from the top.
$PSVersionTable Variable
The $PSVersionTable variable provides detailed information about the PowerShell version and its components. It’s a useful way to get comprehensive version details.
Open PowerShell and enter the following command:
$PSVersionTable
This command will display a table with various properties, including PSVersion, PSEdition, and more. The PSVersion property shows the main version of PowerShell you are using, while other properties provide additional information about the environment.
How to Check Your PowerShell Version in the Windows Registry
It’s highly recommended that you check your current PowerShell version via the command line. You should only use Windows Registry if you know what you’re doing, as one wrong move can cause irreversible system damage.
If you are sure you want to check your PowerShell version via the Windows Registry, here’s how.
- Open Windows Registry by pressing Windows Key + R and the running regedit.
Now, in the Registry Editor, navigate to the following path:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine
- In the right-hand pane, double-click the entry named PowerShellVersion. The value of this entry indicates the installed PowerShell version.
Which Versions of PowerShell Come Preinstalled With Windows OS?
Different versions of Windows come with different preinstalled versions of PowerShell:
These preinstalled versions provide basic functionality, but you can always install the latest version of PowerShell for additional features and improvements.
How to Check the PowerShell Version on Remote PCs
You can use PowerShell Remoting to check the PowerShell version on remote machines. PowerShell Remoting allows you to run commands on one or more remote computers.
First, make sure that PowerShell Remoting is enabled on the remote PCs. You can turn it on by running the following command on each remote machine:
Enable-PSRemoting -Force
Once Remoting is enabled, you can check the PowerShell version on remote machines. Open PowerShell and run this command:
Invoke-Command -ComputerName RemotePCName -ScriptBlock {$PSVersionTable.PSVersion}
The PowerShell version will then be returned.
Checking the PowerShell Version on macOS
You can also check which version of PowerShell you’re using on your Mac. To do so, open PowerShell and run the following command:
$PSVersionTable.PSVersion
As with the $Host.Version command on Windows, you’ll see Major, Minor, and Build. In our example, we see that Major is 7, Minor is 4, and Build is 3.
So, our PowerShell version is 7.4.3.
Checking the PowerShell Version on Linux
You can also check which version of PowerShell you’re using Linux. We’ll use Ubuntu in this example, but the command is the same across Linux distributions (i.e., CentOS/RHEL, Debian).
Open PowerShell and run the following command:
$PSVersionTable.PSVersion
Pay attention to the Major, Minor, and Patch variables. Ours is 7, 4, and 3, respectively. This means we’re running PowerShell version 7.4.3.
How Can I Install the Latest Version of PowerShell?
There will come a time when you’ll need to update the version of PowerShell that you’re using. The steps required depend on which OS you’re using.
On Windows, you can download and install PowerShell from the official PowerShell GitHub releases page. This page provides MSI installers for various Windows versions, making the installation process straightforward. For detailed instructions, visit the PowerShell GitHub releases page.
On macOS, you can install PowerShell using Homebrew, a popular package manager for macOS. This method simplifies the installation process. For detailed instructions, visit the official documentation: Installing PowerShell on macOS.
For Linux distributions like Ubuntu, CentOS/RHEL, and Debian, PowerShell can be installed using package managers like apt or yum. Each distribution has specific commands and steps for installation. For more information, check the PowerShell download on Linux documentation.
The Bottom Line
PowerShell is a valuable tool for task automation and system management. Checking your PowerShell version is straightforward, regardless of the operating system you’re using. By using the latest version, you benefit from the newest features and security improvements.
Use official documentation and resources for installation and updates, and learn the different methods to check your PowerShell version on various systems.
FAQs
How do I know what version of PowerShell I have?
How do I find my PowerShell OS version?
How to check if PowerShell 2.0 is enabled?
How do I find PowerShell?
Why do I need to know which PowerShell version I’m using?
What version of PowerShell do I have?
References
- Releases: PowerShell/PowerShell (Github)
- Installing PowerShell on macOS (Learn.microsoft)
- Install PowerShell on Linux (Learn.microsoft)