How to Check My PowerShell Version? : Chris

How to Check My PowerShell Version?
by: Chris
blow post content copied from  Be on the Right Side of Change
click here to view original post


5/5 - (1 vote)

Do you need to know how to check your PowerShell version? This mission-critical question was on my mind, too, just a few minutes ago. In this article, I’ll show you how I did it. Ready? Check, go! ๐Ÿ‘‡

Identify Your PowerShell Version

One of the most common and recommended ways is by using the $PSVersionTable automatic variable. Simply open a PowerShell window and enter $PSVersionTable into the prompt. The current PowerShell version will be displayed next to “PSVersion” ๐Ÿ˜Š.

PS C:\Users\xcent> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.22621.1778
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.1778
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Another method to check the PowerShell version is by utilizing the $host.Version property. Type $host.Version into the PowerShell prompt, and it will display the version number of your PowerShell engine.

Access Registry of PowerShell Version

If you’re looking for a more detailed approach, you can access the registry to find the PowerShell version. The registry key for the PowerShell engine version is located at HKLM:\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine. Use the Get-ItemProperty cmdlet to obtain the version number as follows:

Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine" -Name "PowerShellVersion"

This command will output the version number of the PowerShell engine installed on your system:

PowerShellVersion : 5.1.22621.1
PSPath            : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\PowerShellEn
                    gine
PSParentPath      : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3
PSChildName       : PowerShellEngine
PSDrive           : HKLM
PSProvider        : Microsoft.PowerShell.Core\Registry

Get the PowerShell Edition

In addition to the version number, you might be interested in the PowerShell edition. The $PSVersionTable.PSEdition property can help. Enter $PSVersionTable.PSEdition in the PowerShell prompt to obtain the edition information.

PS C:\Users\xcent> $PSVersionTable.PSEdition
Desktop

Remember to keep the tone confident, knowledgeable, neutral, and clear while conveying this information. By following these methods, you can efficiently identify the PowerShell version and edition on your system, making it easier to access the features and capabilities it offers.

PowerShell Versions Overview

PowerShell is a powerful scripting language and automation platform that comes pre-installed with various Windows operating systems. It is built on the .NET Framework and has seen multiple versions released over the years, with significant upgrades and improvements.

The first iteration, PowerShell 1.0, was released in 2006 as part of the Windows Management Framework. It marked the beginning of a new era in Windows administration, allowing sysadmins to automate tasks with great efficiency. However, it had limited functionality compared to its successors and relied on the .NET Framework 2.0.

Windows PowerShell 2.0 through 5.0 saw steady improvements, with each release adding features and cmdlets that expanded automation capabilities for administrators. In Windows PowerShell 5.1, the last version of the “Desktop Edition,” the scripting language reached its peak in terms of cmdlets and functionality. It was bundled with the Windows Management Framework 5.1, and .NET Framework 4.5.2 or later was required for compatibility.

PowerShell Core 6.0 represented a shift in the platform, with Microsoft introducing the open-source, cross-platform “Core Edition.” ๐ŸŒ Based on .NET Core, PowerShell Core broadened the scripting language’s reach, enabling it to run on Linux and macOS systems, in addition to Windows. This version also dropped features not compatible with .NET Core, making it somewhat smaller in scope compared to Windows PowerShell 5.1.

Finally, PowerShell 7 arrived, combining the capabilities of Windows PowerShell and PowerShell Core to create a unified, modern version of the scripting language. Built on .NET Core 3.1 (and later, .NET 5), PowerShell 7 offers numerous enhancements, including performance improvements, added functionality, and support for new cmdlets ๐ŸŽ‰.

To check your PowerShell version, use the $PSVersionTable.PSVersion command in a PowerShell window. This should return the Major, Minor, and Patch versions of the PowerShell instance you are running.๐Ÿ’ก

Installing and Updating PowerShell

Installing PowerShell on Windows is a straightforward process. For Windows clients, the recommended way to install PowerShell is by using Winget. For more information on installation methods, you can refer to the Microsoft Learn guide.

PowerShell Core is available on platforms beyond Windows, including macOS and Linux. To update PowerShell on your system, you’ll need to download and install the latest version.

For a more detailed explanation of how to update PowerShell, you can check this LazyAdmin guide. Keep in mind that after installation, a system reboot may be necessary to make use of the new version.

For Windows 10 users, you can check your PowerShell version by opening a PowerShell window and entering $PSVersionTable. The current PowerShell version will be displayed next to “PSVersion.”

PowerShell Core 7 is a major update that includes support for additional operating systems, such as Windows 11 and Windows Server versions. While it may be installed and run side-by-side with existing Windows PowerShell installations, consider migrating to PowerShell 7 for its enhanced features, improved performance, and cross-platform compatibility. The Microsoft Learn documentation provides in-depth information on migrating from Windows PowerShell 5.1 to PowerShell 7.

When downloading PowerShell, ensure that you are obtaining the installer file or pwsh.exe from the official GitHub repository to guarantee the software’s authenticity and security. The Core and Desktop editions are available as separate downloads, so it’s essential to choose the correct version for your needs.

YouTube Video

๐Ÿง™ Recommended: PowerShell Operators

PowerShell Compatibility and Differences

PowerShell has evolved over time, with the newer PowerShell 7 being designed to provide cross-platform support on Windows, Linux, and MacOS. It was previously known as PowerShell Core and has gradually become the go-to version due to its flexibility and added functionality compared to the older, Windows-exclusive, PowerShell 5.1.

PowerShell 7 is built on the .NET Core, which allows for improved compatibility with non-Windows systems. On the other hand, Windows PowerShell 5.1 relies on the .NET Framework, limiting its usage to Windows-based environments. This shift to a cross-platform focus in PowerShell 7 brings some differences in the availability and behavior of cmdlets between Windows and non-Windows platforms ๐Ÿ˜Š.

One of the key features in PowerShell 7 is its ability to coexist with Windows PowerShell 5.1, ensuring a smooth migration and protection of your PowerShell investments. Separating installation paths, executable names, PSModulePaths, and profiles for each version plays a part in achieving this compatibility ๐Ÿ”„.

Determining your PowerShell version can be helpful in understanding the features and cmdlets available to you. To check the PowerShell version in Windows, open a PowerShell window and enter $PSVersionTable into the prompt. The current version will be displayed next to “PSVersion” ๐Ÿ”.

To enhance compatibility, the PSScriptAnalyzer can be used to check PowerShell version compatibility, ensuring that the syntax and commands used in your script work seamlessly across different PowerShell environments.

Frequently Asked Questions

How do I determine my PowerShell version?

To find out your PowerShell version, open a PowerShell window and enter the command $PSVersionTable. The version will be displayed next to “PSVersion.” Alternatively, you can also use the $host.Version property to determine the version. ๐Ÿ–ฅ

How can I upgrade from PowerShell 5.1 to 7?

Upgrading from PowerShell 5.1 to 7 is a straightforward process. First, head to the PowerShell GitHub release page and download the appropriate installer for your system. Once downloaded, run the installer, and follow the prompts to complete the installation. After installation is complete, you can check your new version by running $PSVersionTable in a PowerShell window. ⏫

What is the latest version of PowerShell available?

To stay up-to-date with the latest PowerShell version, you should regularly check the PowerShell GitHub releases page. The newest version will be listed on the page with release notes for additional information on features and improvements. ๐Ÿš€

How to view PowerShell version on Windows 10?

In Windows 10, open a PowerShell window by searching for “powershell” in the Start menu. Once the PowerShell window is open, type in $PSVersionTable and press Enter. You can also use the $host.Version property to check the version. Windows 10 will then display your PowerShell version next to “PSVersion.” ๐ŸŸฆ

How can I update my PowerShell to the latest version?

To update PowerShell to the latest version, visit the PowerShell GitHub releases page and download the installer for your system. Once downloaded, run the installer, and follow the on-screen prompts to complete the installation process.

Where can I download PowerShell 7?

PowerShell 7 can be downloaded from the PowerShell GitHub releases page.

YouTube Video

๐Ÿ‘‰ Recommended: PowerShell Developer – Income and Opportunity


July 02, 2023 at 12:37AM
Click here for more details...

=============================
The original post is available in Be on the Right Side of Change by Chris
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.
============================

Salesforce