PowerShell V2 CTP2

I download the latest CTP2 build yesterday and installed it on a couple of machines – all seems to be fine, nothing appears to be broken yet!  The remoting has changed significantly since the last CTP and looks like it’s going to be a fantastic facility (shame it’s going to be quite a long while before I can rely on V2 being available on all the production machines I come across – oh well!)

Thanks to Shay and Marco on the newsgroup for pointing me in the direction of the WinRM CTP – you’ll need to install this too from here before you can run the Configure-WSMan.PS1 script supplied with the CTP2 build.  The WinRM CTP install requires a reboot.

Versioning

I now have PowerShell V1 and V2 to contend with – as well as running different hosts (PowerShell and PowerShell Plus) and the PSCX plug-in.  When writing scripts that rely on a particular feature I usually try to test before-hand to make sure that feature is going to be there.  I was stumped for a while trying to find out if I was running on V1 or V2 (the underlying PowerShell engine version) – Get-Host would normally do the trick, but in PS+ the Get-Host cmdlet only tells me I’m running in PSPlus – nothing about the underlying engine.

PSCX uses "$PSVersionString = (Get-FileVersionInfo "$PSHome\PowerShell.exe").ProductVersion" – but that’s no good if PSCX isn’t loaded.

Luckily, hunting around in the help files for CTP2 revealed a new $PSVersionTable hash:

PS> $PSVersionTable

Name                           Value
—-                           —–
CLRVersion                     2.0.50727.1434
BuildVersion                   6.1.6585.1
PSVersion                      2.0
PSCompatibleVersions           {1.0, 2.0}

 

Just the job:-)

 

Chris

Advertisements

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