Hyper-V: Script to Check IC Version

Hyper-V: Script to Check IC Version



Here is a script for checking the version number of your VM integration components created by Microsoft software developer Stefan Wernli.


Script

 # Test if the IC version is up to date

param(
    [string]$vmName = $(throw "Must specify virtual machine name")
)

$vm = gwmi -namespace root\virtualization Msvm_ComputerSystem -filter "ElementName='$vmName'"

# Get the associated KVP Exchange component
$kvp = gwmi -namespace root\virtualization `
    -query "Associators of {$vm} where ResultClass=Msvm_KvpExchangeComponent"

# Pull the Guest Intrinsic Exchange Items from XML into a hash
$kvpHash = @{}
if($kvp.GuestIntrinsicExchangeItems){
    $xmlContents = ([xml]("<xml>"+$kvp.GuestIntrinsicExchangeItems+"</xml>"))
    foreach($instance in $xmlContents.xml.INSTANCE)
    { 
        $name = $instance.PROPERTY | where {$_.NAME -eq "Name"}
        $data = $instance.PROPERTY | where {$_.NAME -eq "Data"}
        $kvphash.add($name.Value,$data.Value)
    }
}

# Save the guest's version
$icVersionGuest = $kvpHash.IntegrationServicesVersion

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

return -not ([version]$icVersionGuest -lt [version]$icVersionHost)

Not Detected

NOTE: If VMM displays ‘not detected’ then the VM additions are not current.



If VM’s are shutdown you can use the VMM GUI to install guest additions:


 

Community Resources

 

Leave a Comment
  • Please add 4 and 6 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Richard Mueller edited Revision 18. Comment: Removed blank heading in HTML to fix TOC

  • Richard Mueller edited Revision 16. Comment: Removed (en-US) from title, added tag

  • Ed Price - MSFT edited Revision 13. Comment: Added TOC and tags

  • Ed Price - MSFT edited Revision 12. Comment: Adding tags

  • tonysoper_MSFT edited Revision 10. Comment: booth demo

  • FZB edited Revision 8. Comment: typo

  • Fernando Lugão Veltem edited Revision 7. Comment: alter title and tags, added en-US

  • Ed Price - MSFT edited Revision 4. Comment: Added white space

  • swernli edited Original. Comment: removing formatting and adding horizontal rule

Page 1 of 1 (9 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • swernli edited Original. Comment: removing formatting and adding horizontal rule

  • Ed Price - MSFT edited Revision 4. Comment: Added white space

  • Fernando Lugão Veltem edited Revision 7. Comment: alter title and tags, added en-US

  • FZB edited Revision 8. Comment: typo

  • tonysoper_MSFT edited Revision 10. Comment: booth demo

  • Ed Price - MSFT edited Revision 12. Comment: Adding tags

  • Ed Price - MSFT edited Revision 13. Comment: Added TOC and tags

  • Thanks.

  • Richard Mueller edited Revision 16. Comment: Removed (en-US) from title, added tag

  • Thanks

  • Richard Mueller edited Revision 18. Comment: Removed blank heading in HTML to fix TOC

Page 1 of 1 (11 items)