PowerShell script to tell you if you need to update your Integration Services

A while ago I did a blog post that showed you how easy it was to check what version of the Integration Services were installed inside your virtual machines.  However, a number of people came back to me and said: “Ben, I do not really care about the version number of the integration services – what I want to know is whether I need to update the integration services or not”.


That is a much trickier problem to solve.  In fact, in Windows Server 2008 and Windows Server 2008 R2 it is not really possible to write a good script that will do this.  Luckily, it is possible to write a script for this in Windows 8 / Windows Server 2012.  Unfortunately, it is not the simplest script around.

There are a couple of reasons for this:

  1. You can’t do this with the Hyper-V PowerShell cmdlets, you need to go straight to WMI
  2. This information is only available through GetSummaryInformation – which is a rather strange interface

With that in mind – here is the script that will get you the information you need:

 # GetSummaryInformation documented here: http://msdn.microsoft.com/en-us/library/hh850062(v=vs.85).aspx
 # MSVM_SummaryInformation documented here: http://msdn.microsoft.com/en-us/library/hh850217(v=vs.85).aspx
 # Get the Management Service from the v2 namespace
 $VMMS = gwmi -namespace root\virtualization\v2 Msvm_VirtualSystemManagementService
 # 1 == VM friendly name. 123 == Integration State
 $RequestedSummaryInformationArray = 1,123
 $vmSummaryInformationArray = $VMMS.GetSummaryInformation($null, $RequestedSummaryInformationArray).SummaryInformation
 # Create an empty array to store the results in
 $outputArray = @()
 # Go over the results of the GetSummaryInformation Call
 foreach ($vmSummaryInformation in [array] $vmSummaryInformationArray)
    # Turn result codes into readable English
    switch ($vmSummaryInformation.IntegrationServicesVersionState)
        1       {$vmIntegrationServicesVersionState = "Up-to-date"}
        2       {$vmIntegrationServicesVersionState = "Version Mismatch"}
        default {$vmIntegrationServicesVersionState = "Unknown"}
    # Use Hyper-V PowerShell cmdlets to quickly get the integration version number
    $vmIntegrationServicesVersion = (get-vm $vmSummaryInformation.ElementName).IntegrationServicesVersion
    # Display "Unknown" if we got a null result
    if ($vmIntegrationServicesVersion -eq $null) {$vmIntegrationServicesVersion = "Unknown"}
    # Put the VM Name, Integration Service Version and State in a PSObject - so we can display a nice table at the end
    $output = new-object psobject
    $output | add-member noteproperty "VM Name" $vmSummaryInformation.ElementName
    $output | add-member noteproperty "Integration Services Version" $vmIntegrationServicesVersion
    $output | add-member noteproperty "Integration Services State" $vmIntegrationServicesVersionState
    # Add the PSObject to the output Array
    $outputArray += $output
 # Display information in nicely formatted table
 write-output $outputArray | sort "VM Name"

If I run this script on one of my Hyper-V servers – I get this:


Looks like I need to do a lot of integration service updates.  Bummer.

But getting back to the script – what is GetSummaryInformation and why is it so tricky to use?  GetSummaryInformation is a WMI method that we implemented to allow people to get a lot of random information about virtual machines in a quick and efficient method.  The way it works is that you call it and pass in an array of numbers – this array indicates the information that you want to get about the virtual machines.  You can read all of the possible options here: http://msdn.microsoft.com/en-us/library/hh850217(v=vs.85).aspx

One final note – in order to get the Integration Services state – you need to use the WMI v2 namespace.