PowerTip: Check Version of PowerShell


Summary: Learn how to check your version of Windows PowerShell.

Hey, Scripting Guy! Question How can I find what version of Windows PowerShell my computer is running?

Hey, Scripting Guy! Answer Use the automatic $PSVersionTable variable, and check the PSVersion property, for example:

$PSVersionTable.PSVersion

Comments (12)

  1. tommymaynard says:

    I want to weigh in and reiterate that Thomas is absolutely correct. Don’t use Get-Host, or $host, to determine the installed version of PowerShell. Instead, always use the $PSVersionTable automatic variable. Get-Host, or $host, returns the version of the
    host, not the version PowerShell.

    When run on your local computer, the console (ConsoleHost) and ISE (Windows PowerShell ISE Host) will often be the same version of PowerShell, but run Get-Host inside a PSRemoting session and you’ll get the version of the ServerRemoteHost. I did a quick test
    and the version returned, while in a PSRemoting session and using Get-Host, was 1.0.0.0 on a machine running PowerShell 4.0. Try it yourself.

  2. Vandrey Trindade says:

    I use (Get-Host).version
    The $PSVersionTable.PSVersion is better?

  3. thomas says:

    @Vandrey: Get-Host does NOT return the PowerShell version. Check this post for details:
    http://www.thomas-franke.net/managing-powershell-version-issues/

  4. Todd says:

    Thanks guys. I appreciate the additional information. Tried it on several machines, with varying architectures and OS, and for me both commands provide the same basic information I need regarding the version of PowerShell installed.

    For me, there are too many conflicting articles out there to make a determination on what one tool is right. Therefore (and for the time being), I will continue using both until I see something different in the tests I run–or until we hear from Don Jones or
    Jeffrey Snover.

    Get-Host (http://technet.microsoft.com/en-us/library/hh849946(v=wps.620).aspx) … "The default display includes the Windows PowerShell version number".

    Additionally (http://technet.microsoft.com/en-us/library/ee176850.aspx) … "The Get-Host cmdlet returns information (such as the version number) for Windows PowerShell".

  5. Todd says:

    Alright! I pinged one PowerShell MVP (Jeffery Hicks) and he confirmed $PSVersionTable is the tool to use.

    He suggested we run one of the following commands to provide the output we are looking for to get the PowerShell version installed on a machine.

    1) $psversiontable.psversion (as recommended in this article)

    2) $psversiontable.psversion.major

    3) $psversiontable.psversion.tostring()

    “In the mouth of two or three witnesses shall every word be established.” I am still looking for at least one more witness and will update accordingly.

  6. Todd says:

    Here is another response from a PowerShell MVP (Jason Helmick)…

    "To locate the PowerShell host version I normally just use Get-Host and look at the version property. $PSVersionTable provides the same information but also includes versions of other WMF components. So – if I wanted to know anything other then the host version
    – which is rare – I would $PSVersionTable – such as the version of Remoting or the CLR. again – you usually just need the version property from Get-Host."

    Even amongst MVPs, we still don’t have a consensus on which is the "superior" command other than both provide the needed information. I guess the choice is ours depending on the need.

  7. Dennis Arvidson says:

    Unfortunately, one of the major reasons you need to do this is because of issues in Powershell v1.0. You failed to mention that this is useless in version 1.0.

  8. Quincy Sanders says:

    Thomas, I’m not sure what you are referring to however, when I use Vandrey’s suggested method, (Get-Host).version, it works like a charm and it is my preferred method because it’s 10 or so less chars than $PSVersionTable.PSVersion. lol

  9. Joy Banerjee says:

    Yes this is the best example which we can run to get the PowerShell Version – I have created a Video on my Blog You may Also Like it –
    http://aikitsupport.com/how-to-check-the-powershell-version/

  10. Mark says:

    Doesn’t $PSVersionTable break with the prescribed powershell nomenclature?

Skip to main content