4 Ways to Check the Current PowerShell Version on Your PC

Introduction

If you are reading this guide because you want to learn how to find the PowerShell version on your computer,you are in the right place!

This guide details 4 ways you can check the version of PowerSell on your computer.

4 Ways to Get the PowerShell Version on your PC

If you want to determine the version of PowerShell on your computer,use one of the methods/commands discussed below:

Method 1: Get PowerShell Version with $PsversionTable Automatic Variable

copy and paste the command below into a PowerShell console and press Enter

$PsversionTable

Here is the result

 

My current PS version is 5.1.17134.858 but the result contains other information which you may not need.

To display just the version number,use the command below

$PsversionTable.Psversion

Here is the result

 

The last command provides a bit more information. We Now kNow that 5,1,17134,858 represents Major,Minor,Build and Revision numbers.

To display just the Major number,use this command:

$PsversionTable.Psversion.Major

Method 2: Get PS Version with Get-Variable PsversionTable Command

You can also get your PS version using the command below:

powershell -command "(Get-Variable PsversionTable -ValueOnly).Psversion"

The result is the same as the last command

 

Method 3: Get PowerShell Version with Get-Host Command

Here is another command that will give your PS version

Get-Host

The command returned a result with the full version details

 

If you want just the version number,you can use any of the 3 commands below:

Get-Host | Select-Object Version

This command will expand the version numbers

Get-Host | Select-Object -ExpandProperty Version

(Get-Host).Version

The last two commands product the same result. Here are the results of the 3 commands

 

If you want to display just the Major PowerShell version,use this command:

(Get-Host).Version.Major

Method 4: Get Powershell Version with $Host Automatic Variable

To use this method type the following command into a PowerShell prompt. Then press Enter.

$Host

Below is the result of the command in PowerShell

 

As you can see,the result is the same as using the Get-Host Command

Here is an example:

 

Conclusion

There are so many reasons you may want to determine the PowerShell version. It may be that you wrote a script that requires a minimum version to run successfully. No matter your reason,I hope it met your need!

If you have any question or want to leave a comment,use the “Leave a Reply” form at the end of this script. Alternatively,you Could share your experience working with PowerShell versions.

 

相关文章

显卡天梯图2024最新版,显卡是电脑进行图形处理的重要设备,...
初始化电脑时出现问题怎么办,可以使用win系统的安装介质,连...
todesk远程开机怎么设置,两台电脑要在同一局域网内,然后需...
油猴谷歌插件怎么安装,可以通过谷歌应用商店进行安装,需要...
虚拟内存这个名词想必很多人都听说过,我们在使用电脑的时候...
win11本地账户怎么改名?win11很多操作都变了样,用户如果想要...