PowerShell is a powerful scripting language and shell framework developed by Microsoft. It is widely used by administrators and developers to automate tasks and manage systems. As PowerShell continues to evolve, new features, cmdlets, and improvements are introduced with each version. Knowing your PowerShell version is crucial to ensure compatibility with scripts, modules, and features.
This article will provide a step-by-step guide on how to check your PowerShell version and help you stay informed about the capabilities of your environment.
1. Understanding PowerShell Versions
PowerShell has evolved over time, with each version introducing new features and improvements. Here is an overview of the major PowerShell versions:
- PowerShell 1.0: The initial release, introduced in 2006.
- PowerShell 2.0: Released in 2009, featuring enhanced scripting capabilities and the introduction of PowerShell remoting.
- PowerShell 3.0: Launched in 2012, providing improved performance, new cmdlets, and workflow support.
- PowerShell 4.0: Released in 2013, offering enhanced Desired State Configuration (DSC) features and new cmdlets.
- PowerShell 5.0 and 5.1: Introduced in 2015 and 2016, respectively, with advanced scripting, classes support, and improved security features.
- PowerShell Core 6.x: A cross-platform version of PowerShell, released in 2018, supporting Windows, macOS, and Linux.
- PowerShell 7.x: The successor to PowerShell Core 6.x, combining the best of both Windows PowerShell and PowerShell Core.
2. Checking PowerShell Version on Windows
To check your PowerShell version on a Windows system, follow these steps:
Step 1: Open PowerShell
- Press the Windows key or click on the Start button.
- Type “PowerShell” in the search bar.
- Click on “Windows PowerShell” from the search results to open it.
Step 2: Check PowerShell Version
In the PowerShell window, type the following command and press Enter:
1 | $PSVersionTable.PSVersion |
The output will display the PowerShell version details, including Major, Minor, Build, and Revision numbers.
3. Checking PowerShell Version on macOS and Linux
For macOS and Linux systems using PowerShell Core 6.x or PowerShell 7.x, follow these steps:
Step 1: Open Terminal
- On macOS, open the Terminal app from the Applications > Utilities folder or use Spotlight search to find it.
- On Linux, open your preferred terminal emulator, such as GNOME Terminal or Konsole.
Step 2: Check PowerShell Version
In the terminal window, type “pwsh” and press Enter to launch PowerShell.
Enter the following command and press Enter:
1 | $PSVersionTable.PSVersion |
The output will display the PowerShell version details, including Major, Minor, Build, and Revision numbers.
Conclusion
Knowing your PowerShell version is essential for compatibility with scripts, modules, and features. By following this step-by-step guide, you can easily check your PowerShell version on Windows, macOS, or Linux systems. Staying informed about your PowerShell environment helps ensure that you can take advantage of the latest features and improvements while maintaining compatibility with your existing scripts and tools.