Thursday, July 17, 2008

Determining your Hyper-V version

<rant>

Figuring out versions is often way too hard. Why can't I simply see the version in Add or Remove Programs or in the feature overview? Why do I have to mess around with build numbers? Isn't this 2008!

</rant>

The other day, I had to figure out which Hyper-V and SCVMM version a server was running. Luckily, I found this and this article.

I PowerShelled the Hyper-V part, so you can use it easily in your scripts (and if you execute the WMIC command from PowerShell, it will not work owing to parsing differences between cmd and PowerShell). Here is my Get-HyperVVersion.ps1, but you can also execute it directly -

$file=get-command c:\windows\system32\vmms.exe
switch ($file.fileversioninfo.productversion.split(".")[-1]) {
17101 { "Beta" }
18004 { "RC0" }
18010 { "RC1" }
18016 { "RTM" }
}


Note how Get-Command can 'reveal' the versioninfo of a executable/DLL.

No comments: