WTF: PowerShell 3 & Cygwin

I found some WTF I cannot explain.

I have PowerShell 3 installed. But I have ability to run PowerShell 2 host

C:\Users\Michael>PowerShell -Version 2
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

C:\Users\Michael> $host.Version

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

But if I do the same from Cygwin it does not work properly

$ PowerShell -Version 2
Windows PowerShell
Copyright (C) 2012 Microsoft Corporation. All rights reserved.

C:\Users\Michael> $host.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
3      0      -1     -1

WTF? Why it is still running PowerShell 3 ?!!

Moreover, I even tried to call cmd in between

$ cmd
Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.

C:\Users\Michael>PowerShell -Version 2
Windows PowerShell
Copyright (C) 2012 Microsoft Corporation. All rights reserved.

C:\Users\Michael> $host.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
3      0      -1     -1

The same effect..

Does anyone know why that happens?!

It very annoying, especially because of the bug with breakpoints.

So far I could not find a way how to run PowerShell 2 from my machine, and I have to use VM for that… Very annoying!

If you curious why I need to run PowerShell from Cygwin, it is because of the git hooks I am writing.
To develop server-side hooks I write PowerShell script, and because of the problem described above, I cannot use my nice trick with breakpoints

UPD:
Raised question on stackoverflow

Advertisements

About mnaoumov

Senior .NET Developer in Readify
This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

2 Responses to WTF: PowerShell 3 & Cygwin

  1. Jeffrey Snover [MSFT] says:

    Can you say more about your Cygwin environment – are running the Cygwin terminal?
    Also what version of Windows are you running?

  2. mnaoumov says:

    I am using Cygwin 1.7.11 terminal on Windows 8

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