One important point to guarantee a good performance of our virtual machines, is to validate that they have installed the lastest version of the “Integration Components”. If we must validate the version in one or two machines we can do it checking the driver version of c:\windows\system32\drivers\vmbus.sys file.

But if we needed to obtain this data for a great number of machines we will have to use PowerShell or scripts. Unfortunately, checking  IC's version from host by means of scripts or Powershell is not a simple task, and for that reason I wrote this script to facilitate this task.

This script check the driver version of vmbus.sys within the virtual machine , and creates a registry key with its value in “HKLM\SOFTWARE\Virtual Machine\Auto\IC Version”. Once executed inside our VM's, we will be able to get the value from host, by means of script that has been published by Micheal Michael http://blogs.technet.com/m2/archive/2009/06/10/how-to-get-data-like-the-integration-services-version-from-msvm-kvpexchangedataitem-in-hyper-v.aspx

Note that WS08 R2 and W7 VM's already have this registry so there is no need to add it manually. This script can be published inside a GPO to run it on every restart If our VM's are joined to a domain

<< 

const HKEY_LOCAL_MACHINE = &H80000002
strVersion = ""
strkeyPath = "SOFTWARE\Microsoft\Virtual Machine\Auto"
strkeyName = "IC Version"
strComputer = "."

set WSHShell = WScript.CreateObject("WScript.shell")
sysroot = WshShell.ExpandEnvironmentStrings("%systemroot%")

Set objFSO = CreateObject("Scripting.FileSystemObject")
strversion = objFSO.GetFileVersion(sysroot & "\system32\drivers\vmbus.sys")

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:stdRegProv")
oReg.SetStringValue HKEY_LOCAL_MACHINE,strkeypath,strkeyname,strversion

Wscript.Echo "IC version: " & strversion & " added to registry on HKLM\" & strkeypath

<<