Have you ever wondered what PowerShell version your machine was running? Needed to quickly check the PowerShell version to see whether it had successfully upgraded? Well I am going to show you how.
Today I was on one of my creaky old SQL Servers when I started doing some inventory checks to see what level the SQL 2000 and Windows Server 2003 were patched to and do some other inventory checks . Usually I would use some PowerShell scripts but as this Server exists in an old secured environment I could not us them and wondered whether it would be worth going through the motion of getting the scripts screened and approved. Before that I thought I should at least check what version of PowerShell was on the box and having never used PowerShell with Server 2003 or SQL 2000 thought this would be a good bit of fun.
I saw the PowerShell icon and felt uplifted and started it. I then typed $psversiontable and got an error. I had no access to google so it took me a few minutes to remember that the command ‘get-host’ had the information required. When it returned version 1.0 I decided to just stick with the current methods as I didn’t think it would be worth my time checking if my scripts would work in 1.0 when everything I had developed on version 2.0 and higher.
So in the future I would recommend using either of the two below commands to get the version number.
Get-host
$psversiontable


Originally published at https://parvtheitgeek.com on January 30, 2014.