A script to check the Integration Services Version on Hyper-V Host and Guests

A script to check the Integration Services Version on Hyper-V Host and Guests

Rate This
  • Comments 7

Hi,

Scripting time again!

Really often, I need to check if the Integration Services Version of the Hyper-V guests are up to date. Some Updates für Hyper-V update the vmguest.iso on the Host. So you need to manually go the VM's afterwards and install the Integrations services again.

To check the "Comprehensive list of Hyper-V R2 updates" go to  http://technet.microsoft.com/en-us/library/ff394763(WS.10).aspx

The Integration Services Version as of this writing is "6.1.7600.20778"

The script below is a extension to # http://blogs.msdn.com/b/virtual_pc_guy/archive/2008/11/18/hyper-v-script-looking-at-kvp-guestintrinsicexchangeitems.aspx which displays the Version of each running guest, and also displays which Integration Services Version is currently offered on the Host.

If you don't see  Integraton Services Version displayed for a VMl, they are certainly not current.

If the Host is up to date, and has a more recent IC Version as your Guests, you might consider an update!

Cheers

Robert

 

 

# Script to determine the IC Version on the Hyper-V Host
# and output KVP Date of the running Guests
# rvi 1.0
# based on:
# http://blogs.msdn.com/b/virtual_pc_guy/archive/2008/11/18/hyper-v-script-looking-at-kvp-guestintrinsicexchangeitems.aspx
# and
# http://social.technet.microsoft.com/wiki/contents/articles/hyper-v-script-to-check-ic-version.aspx
#

 

# Filter for parsing XML data
filter Import-CimXml
{
   # Create new XML object from input
   $CimXml = [Xml]$_
   $CimObj = New-Object -TypeName System.Object
 
   # Iterate over the data and pull out just the value name and data for each entry
   foreach ($CimProperty in $CimXml.SelectNodes("/INSTANCE/PROPERTY[@NAME='Name']"))
      {
         $CimObj | Add-Member -MemberType NoteProperty -Name $CimProperty.NAME -Value $CimProperty.VALUE
      }
 
   foreach ($CimProperty in $CimXml.SelectNodes("/INSTANCE/PROPERTY[@NAME='Data']"))
      {
         $CimObj | Add-Member -MemberType NoteProperty -Name $CimProperty.NAME -Value $CimProperty.VALUE
      }
 
   # Display output
   $CimObj
}
 

## Hostinfo this host
$Server="."
$Hostinfo = Get-WmiObject -class win32_computersystem -computername $Server

Write-Host "Host " $Hostinfo.Name
$HyperVServer = $Hostinfo.Name


# Get the host's ICversion
$icVersionHost = (ls 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\GuestInstaller').`
    GetValue("Microsoft-Hyper-V-Guest-Installer-Win60-Package")

Write-Host "IC Version on Host" $icVersionHost


$vmList = gwmi -namespace root\virtualization Msvm_ComputerSystem |`
    where{$_.Name -ne $env:COMPUTERNAME}
   
foreach ($vminstance in $vmlist)
{
 
    if ($vminstance.OnTimeInMilliseconds -ne 0)
    {
   
 $VMName = $vminstance.ElementName
 
 # Get the virtual machine object
 $query = "Select * From Msvm_ComputerSystem Where ElementName='" + $VMName + "'"
 $Vm = gwmi -namespace root\virtualization -query $query -computername $HyperVServer
 
 # Get the KVP Object
 $query = "Associators of {$Vm} Where AssocClass=Msvm_SystemDevice ResultClass=Msvm_KvpExchangeComponent"
 $Kvp = gwmi -namespace root\virtualization -query $query -computername $HyperVServer
 
 Write-Host
 Write-Host "Guest KVP information for" $VMName
 
 # Filter the results
 $Kvp.GuestIntrinsicExchangeItems | Import-CimXml
    }
}


#End of script

 

Example Ouput:

PS C:\iccheck> .\iccheck1.ps1
Host  HyperVHost1
IC Version on Host 6.1.7600.20778

Guest KVP information for VM2008R2-001

Name                                                        Data
----                                                        ----
FullyQualifiedDomainName                                    vm2008r2-001.contoso.com
OSName                                                      Windows Server 2008 R2 Standard
OSVersion                                                   6.1.7600
CSDVersion
OSMajorVersion                                              6
OSMinorVersion                                              1
OSBuildNumber                                               7600
OSPlatformId                                                2
ServicePackMajor                                            0
ServicePackMinor                                            0
SuiteMask                                                   16
ProductType                                                 3
OSEditionId                                                 7
ProcessorArchitecture                                       9
IntegrationServicesVersion                                  6.1.7600.20542
....

Time to update the Guest....

  • I did the same thing with vb so I could run it out of SCOM. SCOM then raises an alert if the IC version is wrong. Unfortunately I've been unable to update some of my WS08R2 guests. Very frustrating.

  • Does this only run on an R2 host with an R2 guest?

    I've tried on an R2 host with a 2k3 guest, an R1 host on both a R1 guest and an XP guest and in every case I get an error saying the registry key doesn't exist

  • It will only run on a R2 Host. R1 did not have the registry key.

    But on R2, it should run with an 2k3 guest. Below is my output.

    Do you have any Hotfix installed or is your vmguest.iso the RTM version of 2008R2?

    Guest KVP information for w2k3

    FullyQualifiedDomainName                                    w2k3.contoso.com

    OSName                                                      Microsoft Windows Server 2003

    OSVersion                                                   5.2.3790

    CSDVersion                                                  Service Pack 2

    OSMajorVersion                                              5

    OSMinorVersion                                              2

    OSBuildNumber                                               3790

    OSPlatformId                                                2

    ServicePackMajor                                            2

    ServicePackMinor                                            0

    SuiteMask                                                   18

    ProductType                                                 3

    OSEditionId                                                 0

    ProcessorArchitecture                                       0

    IntegrationServicesVersion                                  6.1.7600.20778

  • I'm pretty sure that host is up to date with patches, and that the guests are too. I guess it's time for some double checking my end

  • Is there a similar way to get the Integration Component version of all the VM's - in SCCM or SCOM or SCVMM?

    and Are there any methods to Automate the update of Integration components on large number of VM's (e.g through SCVMM or SCCM?) or on all VM's on a particular host.

    Thanks

    Ashok

  • With all the VM's you mean ones that are not running? Unfortunately not with this method. But you may create a script that runs on startup inside the VM and logs to a central location.

    Automatic update could be easily scripted, and vmguest.iso attached to the VM. You would then need to execute Setup inside the VM, but also expect a reboot of the VM.

  • I tried running this script on windows 2008 R2 core, however getting an error :

    You cannot call a method on a null-valued expressi

    At C:\test.ps1:20 char:48

    +    foreach ($CimProperty in $CimXml.SelectNodes

    ME='Name']"))

       + CategoryInfo          : InvalidOperation: (S

      meException

       + FullyQualifiedErrorId : InvokeMethodOnNull

    You cannot call a method on a null-valued expressi

    At C:\test.ps1:25 char:48

    +    foreach ($CimProperty in $CimXml.SelectNodes

    ME='Data']"))

       + CategoryInfo          : InvalidOperation: (S

      meException

       + FullyQualifiedErrorId : InvokeMethodOnNull

    Any suggestions?

Page 1 of 1 (7 items)
Leave a Comment
  • Please add 6 and 6 and type the answer here:
  • Post