title: The Black Art of PowerShell V2 Version Numbers link: http://sev17.com/2010/01/28/the-black-art-of-powershell-v2-version-numbers/ author: Chad Miller description: post_id: 9993 created: 2010/01/28 11:23:00 created_gmt: 2010/01/28 15:23:00 comment_status: open post_name: the-black-art-of-powershell-v2-version-numbers status: publish post_type: post

The Black Art of PowerShell V2 Version Numbers

Last week while helping someone in the SQLPSX forums having an issue importing modules I suspected they had a CTP version of Powershell, but being the skeptical person I am I needed proof. My first thought was there must be a simple built-in command to return the Powershell version number. In fact there there is with **$PSVersionTable. **This built-in variable was introduced in Powershell V2. If you run $PSVersionTable in Powershell V1 nothing will be returned. If you run $PSVersionTable on Powershell V2 you’ll get, a table of version information.

There’s one problem the version number information returned from $PSVersionTable will be different per OS platform and there isn’t single field that returns a consistent version number across platforms. For example on my x86 Vista the Powershell BuildVersion is 6.0.6002.18111. and on my x86 Windows 7 it is 6.1.7600.16385 yet both are RTM Powershell V2.

For someone coming from a SQL Server background this is suprising . I’ve run SQL Server on x86, x64 and IA-64 platforms with various operating systems, however @@version returns one version number regardless of platform. Of course there are other pieces of data to show the H/W platform and OS available if needed, but in most cases I just want to see the base version number.

Armed with this information I tweeted a question on Friday, Jan 22nd – “How do you tell if somone has a CTP version of  Powershell?” Powershell MVP, Max Trinidad quickly picked up on tweeter thread, tested a few things, blogged and involved other MVPs. The result is a blog post that helped me help someone else. Within a couple of days there were more blog posts on finding CTPs versions…

Are you using the correct PowerShell version by Tobias Weltner

Use The Right Version of PowerShell from the Powershell Team blog

As a result of this exercise I learned several things:

The Powershell community and product team are awesome

OK, I already knew this, but how cool is it that you can tweet a question and have bunch people mobilize to help!

Powershell version numbering is wacked

Let’s fix this in Version 3. Please vote for my connection item to add a version property consistent across all platforms to $psversiontable

Tweeter moves faster than blogs. Blogs move faster than support articles

If I have a question that can easily be expressed in under 140 characters and isn’t too obscure I’ll use Tweeter. Usually I get some really good answers. There used to be a time when the first step to troubleshooting problems with Microsoft products was to search http://support.microsoft.com or going back in the real olden days the TechNet CD’s. Today the idea of looking at a KB article is often an afterthought done when Google/Bing turn up nothing. It would seem even product teams teams would rather blog than initiate a knowledge article. Not that this is a bad thing, personally I’d rather have the information delivered faster in a blog post. Support articles are generated by customer’s calls. When several customers call about the same issue a KB article is published. So, by putting the information out in a blog this may reduce customer calls which then mean no KB article. One last thought on KB articles, not only are they slow to produce, but because they are purely text based they simply haven’t kept pace with how people like to see information . Some of the most helpful blog posts I’ve found for troubleshooting an issue include screen prints or maybe even a video. It is more and more often that I’ll find the answer to problem or setup question in some helpful person’s blog.

For some reason which I don’t fully understand the Powershell team can’t pull down the Powershell CTP download

The problem with not pulling CTP releases is that people will mistakenly grab a CTP instead of a release version. This problem is compounded by search engines returning the Powershell Version 2 CTP download when searching for “Powershell Version 2 Download.” I don’t know if Powershell bloggers who included links to CTP downloads in posts prior to release contribute to the search engine problem or not, but to be safe my suggestion – don’t include links to CTP releases in future posts for unreleased products. The CTP releases are generally pulled from download shortly after a product is released. I don’t know what is common practice as far as timing, but I do know I can’t find old CTP releases of SQL Server (or maybe I’m not looking hard enough). If you have an insight into CTP releases, please comment.