Tuesday, August 19, 2014

Can multiple versions of PowerShell exist on a computer?

Power Shell is one of the most powerful scripting languages to use if are working with Windows. Often you may want to know what version you have on your computer and you may also want to know whether multiple versions can exist side-by-side on a computer.

I purchased a Windows 8.0 laptop and a few days later it was upgraded to Windows 8.1. There have been many Windows Updates since I bought the computer and I am not sure if a version of PowerShell was installed. Also a few months later I installed SQL Server 2012 Developer Edition.
After looking through I discovered that I have two versions 2.0 and 4.0; and they can exist side-by-side.

In my previous post here, I mentioned that you can find the version of your PowerShell installation using the following commandlet.

PS C:\>$PSVersionTable.psversion

As you can see from this post that I had PowerShell Version 3.0 on my Windows 7 (x64) machine

http://hodentekhelp.blogspot.com/2014/08/can-you-use-powershell-to-find.html

In Windows 8.1 using the same commandlet I find the following:
-------------------
Windows PowerShell
Copyright (C) 2013 Microsoft Corporation. All rights reserved.

PS C:\Users\Jayaram> $psversionTable.psversion
Major  Minor  Build  Revision
-----  -----  -----  --------
4      0      -1     -1

---------------------
However when invoked PS from SQL Server as mentioned in this post:
http://hodentekmsss.blogspot.com/2014/04/starting-power-shell-from-sql-server.html

I see that the version is 2.0
--------------------------------
PS SQLSERVER:\SQL\HODENTEK8\REGENCYPARK> $psversionTable.psversion
Major  Minor  Build  Revision
-----  -----  -----  --------
2      0      -1     -1

------------------------------------
This means that the versions 2.0 and 4.0 can exist side-by-side

May be you are interested in these as well:
http://hodentekmsss.blogspot.com/2014/11/a-quick-note-on-writing-powershell_12.html
http://hodentekmsss.blogspot.com/2014/11/a-quick-note-on-writing-powershell.html

No comments: