How to determine PowerShell Version

I wanted to check my PowerShell version information. Perhaps I’ll need to do so in future scripts. Here’s how to determine the PowerShell Version from within PowerShell.

PS C:\Users\david.frette> $host.version

Major Minor Build Revision
—– —– —– ——–
2 0 -1 -1

PS C:\Users\david.frette> $host.version.major
PS C:\Users\david.frette> $host.version.minor
PS C:\Users\david.frette> $
PS C:\Users\david.frette> $host.version.revision


4 responses to “How to determine PowerShell Version”

  1. Larry Weiss says :

    $host.version | select *

    will show all the fields:

    PS C:> $host.version | select *
    Major : 2
    Minor : 0
    Build : -1
    Revision : -1
    MajorRevision : -1
    MinorRevision : -1

  2. Richard Giles says :

    This is not a full proof way to get the version. Other products hosting the PowerShell automation engine may not have implemented the $host correctly. The correct way is to test for $PSVersionTable. If the variable is absent it is version otherwise you can use that variable to get accurate information -> $psversiontable.psversion.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: