PowerTip: Find your version of PowerShell


Summary: Learn how to find your Windows PowerShell version easily.

Hey, Scripting Guy! Question How can I use Windows PowerShell to tell me what version of Windows PowerShell I am running?

Hey, Scripting Guy! Answer Use the $PsVersionTable automatic variable. To see the major, minor, build, and revision of Windows PowerShell, use the following:

$PSVersionTable.PSVersion

The Doctor

 

Comments (4)

  1. tg09nz says:

    Also you could check the DotNet version

    Get-ChildItem ‘HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP’ -recurse |
    Get-ItemProperty -name Version -EA 0 |
    Where { $_.PSChildName -match ‘^(?!S)\p{L}’} |
    Select PSChildName, Version |FT

  2. tommymaynard says:

    @Tim: Get-Host and $Host don’t return the version of PowerShell; they return the version of the hosting application that hosting the PowerShell engine. Take a look at an old post I wrote that demonstrates how you can get yourself in trouble: http://tommymaynard.com/ql-get-the-version-of-powershell-not-its-host. Cheers!

  3. Naeem Mohammad says:

    Well done @tommymaynard for that excellent post. I am guilty myself of using Get-Host to determine the version. Thanks to your post, i will be using $psversiontable.

Skip to main content