SQL SERVER – PowerShell Version Info

I have multiple computer systems at home. I have previously taken a picture of my home office and published it here. Also, I recently had a scenario where I was listing a PowerShell version installed in my computer systems. While searching online, I found two different commands that can determine the version of PowerShell. One of them worked fine in Version 1, while both worked on Version 2.
The commands are:




I have run both the commands on different PowerShell versions and found the following output. This is a call to all PowerShell experts to help me out by letting me know the reasons why these became the results. I am sure that I’m missing something very small, so I ask your help to  clarify this.

PowerShell Version 1

powershell1 SQL SERVER – PowerShell Version Info

PowerShell Version 2

powershell2 SQL SERVER – PowerShell Version Info

Reference : Pinal Dave (http://blog.SQLAuthority.com)

4 thoughts on “SQL SERVER – PowerShell Version Info

  1. $PSVersionTable is not defined in Powershell V1 hence the empty output.

    “One very easy way of distinguishing both versions is to look for a PowerShell variable called $psversiontable. If it is undefined, then you are running V1. If it is there, you have V2. From outside PowerShell, you can also look at a registry key to differentiate between V1 and V2: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine\PowerShellVersion.”



  2. Pingback: SQL SERVER – Weekly Series – Memory Lane – #036 | Journey to SQL Authority with Pinal Dave

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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