Validating Hyper-V 2012 and Failover Clustering 2012 Hotfixes and updates with Powershell

Hi! I know I didn’t write anything for a long time but now I am back again. The good thing about this long “silence” on my blog is that I’ve been really busy helping customers to deploy Windows Server 2012 Hyper-V. This is awesome because the general feeling is that this version is probably the best Hypervisor on the market today. Of course this is a personal opinion and may be influenced by the fact that I work for Microsoft, but it is also true that probably now is the first time I can say it proudly.

Today I want to share with you a really simple Powershell script that detects if your Hyper-V 2012 hosts have installed the updates listed on the TechNet Wiki site that the Product group is updating regularly. The Wiki Site is this one :

Also, the same Powershell script detects if the Failover Cluster 2012 updates listed on this KB article are installed This KB article is also maintained by the PG, so I really encourage you to add both links in your favorites.

UPDATE: Carlos Mayol from our PFE Virtualization team pointed me to this Wiki article as well., so I’ve updated the Cluster XML file to also check these hotfixes . Thank you Carlos 😉

June 6th 2013 UPDATE: XML files have been updated to include the latest changes and updates from the wiki site.

June 22th 2013 UPDATE: XML files have been updated to include the latest changes and updates from the wiki site.

July 15th 2013 UPDATE: XML files have been updated to include the latest changes and updates from the wiki site.

September 24th 2013 UPDATE: XML files have been updated to include the latest changes and updates from the wiki site. (This rollup is important because includes hotfix 2877211 to properly collect disc latency information with perfmon)

The script load 2 XML files content with the list of the hotfixes for Hyper-V and Cluster (I decided two keep them separate for consistency) and then compares this list with the installed hotfixes on your Hyper-V host. I will keep the XML files up to date so come back here for the latest version in the future. The current version of the script includes hotfixes listed on May 24th 2013.

The output is simple and you will quickly see if you need to install some of them or your hosts are up to date. (Please read if the hotfix applies to your environment based on the comments from the links mentioned before)

One last thing! You can specify more than one server to analyze separating the names with “comas” but will require to have permissions to collect the information remotely. The last consideration is that you must unzip the XML and the PS1 files on the same folder. The script will load the XML files content from the current path of the script.

The syntax to execute the script is

"c:\folder\HyperV2012UpdatesCheck.ps1 server1,server2,serverX..”


And here you have the code in case you want to take a look before running it.

   1: param
   2: (
   3:     [parameter(mandatory=$True)]
   4:     [String[]]$HyperHostName
   6: )
   8: #Getting current execution path
   9: $scriptpath = $MyInvocation.MyCommand.Path
  10: $dir = Split-Path $scriptpath
  12: #Loading list of updates from XML files
  14: [xml]$SourceFileHyperV = Get-Content $dir\UpdatesListHyperV.xml
  15: [xml]$SourceFileCluster = Get-Content $dir\UpdatesListCluster.xml
  17: $HyperVHotfixes = $SourceFileHyperV.Updates.Update
  18: $ClusterHotfixes = $SourceFileCluster.Updates.update
  20: #Getting Hotfixes installed on the specified Hyper-V Host
  22: foreach($VMHost in $HyperHostName)
  23: {
  24: $Hotfixes = Get-HotFix -ComputerName $VMHost |select HotfixID,description
  26: Write-Host "COLLECTING HOTFIXES ON HYPER-V HOST: " $HyperHostName -ForegroundColor Yellow
  27: Write-Host "Listing Hyper-V 2012 Hotfixes" -ForegroundColor Yellow
  28: foreach($RecomendedHotfix in $HyperVHotfixes)
  29: {
  30:         $witness = 0
  31:         foreach($hotfix in $Hotfixes)
  32:         {
  33:                 If($ -eq $hotfix.HotfixID)
  34:                 {
  35:                     Write-Host "--------------------------"
  36:                     Write-Host "Hyper-V Host: "$VMHost
  37:                     Write-Host $RecomendedHotfix.Id "installed" -ForegroundColor Green
  38:                     write-host $RecomendedHotfix.Description
  39:                     Write-Host "--------------------------"
  40:                     $witness = 1
  41:                  }
  42:         }  
  43:         if($witness -eq 0)
  44:         {
  45:             Write-Host "--------------------------"
  46:             Write-Host "Hyper-V Host: "$VMHost
  47:             Write-Host $RecomendedHotfix.Id "not installed" -ForegroundColor Red
  48:             write-host $RecomendedHotfix.Description
  49:             Write-Host "--------------------------"
  50:         }
  52: }
  54: Write-Host "Listing Failover Cluster 2012 Hotfixes" -ForegroundColor Yellow
  56: foreach($RecomendedClusterHotfix in $ClusterHotfixes)
  57: {
  58:         $witness = 0
  59:         foreach($hotfix in $Hotfixes)
  60:         {
  61:                 If($ -eq $hotfix.HotfixID)
  62:                 {
  63:                     Write-Host "--------------------------"
  64:                     Write-Host "Hyper-V Host: "$VMHost
  65:                     Write-Host $RecomendedClusterHotfix.Id "installed" -ForegroundColor Green
  66:                     write-host $RecomendedClusterHotfix.Description
  67:                     Write-Host "--------------------------"
  68:                     $witness = 1
  69:                  }
  70:         }  
  71:         if($witness -eq 0)
  72:         {
  73:             Write-Host "--------------------------"
  74:             Write-Host "Hyper-V Host: "$VMHost
  75:             Write-Host $RecomendedClusterHotfix.Id "not installed" -ForegroundColor Red
  76:             write-host $RecomendedClusterHotfix.Description
  77:             Write-Host "--------------------------" 
  78:         }
  79: }
  80: }

Comments (25)
  1. June 6th 2013 UPDATE: XML files have been updated to include the latest changes and updates from the wiki site.

  2. Anonymous says:

    Very good script. Thanks a lot.

  3. Anonymous says:

    I feel that this is very useful script but I can't try it because there aren't xml files by the download link:). There's only ps1 file…

  4. Hi guys,

    I have upload the zip file again that includes the XML files. Please check it again.

  5. Anonymous says:

    Sorry, I post my question 5 minutes later without refresh and Anatoly post the same 🙂

  6. Excellent work, Cristian!! Very useful!

  7. Cristian, I just updated the list of Hyper-V hotfixes on the wiki page. Have a look; probably need to make some XML updates 🙂

  8. Jiri Vana says:

    Hi, I am looking for xml files. The link for download contain only 5040.HyperV2012UpdatesCheck_081871D1.ps1 script. No .zip file with xml files. "You can download it from here:" is blank. Is it correct?

  9. Chris Fortunato says:

    Thanks! I thought I was taking crazy pills, no XMLs

  10. Haecki says:

    Thanks Cristian for sharing your knowledge and for the useful script 🙂

  11. vNiklas says:

    Great script, I have added some object and download stuff in this…/hotfix-and-updates-check-of-hyper-v-and-cluster-with-powershell

    keep up the good work!

  12. Dan Sheehan says:

    This is awesome.

    I have two enhancements requests that would really help us out.

    #1 – Add a PowerShell script switch that allows you to specify if you want to check Hyper-V, Windows Clustering, or both. For example we have non-HyperV clusters we would like to use this script for so we are using a single method consistently, and same thing for non-clustered Hyper-V servers.

    #2 – Add a PowerShell script switch and XML tag that allows you to filter out Windows Update issued hot fixes. We use WSUS here and so we don’t need to worry about those, and would really just like to focus on what we call “out of band” (meaning not issued through an automated mechanism from Microsoft) hot fixes.

    Do you have any plans to potentially host XML files somewhere like an FTP site so we could periodically check to see if there were updates like when there are updates to…/15576.hyper-v-update-list-for-windows-server-2012.aspx ?

    I could make the modifications to the script myself to do these things, but that would be a one off and I figured if we were looking for these features others might be as well (and this is your baby after all).

    Thanks for putting this together in the first place!

  13. Panicos Theodorou says:

    Hi Cristian,

    Could you tell me how to update the xml files so we can do this manually and avoid waiting for your updates?


  14. ReneI says:

    Does your script check for updates applicable to Windows Server 2012 R2?

  15. Ryan Boud says:

    Windows Server 2012 R2 will have no hotfixes at the moment

  16. Wojciech Sciesinski says:


    I’ve started new project on GitHub that hosts this script and I currently work to create some improvements – see…/Get-WindowsHotfixes

    Today I’ve updated UpdatesListCluster.xml – list of hotfixes for Windows Server 2012 – information about KB2894464 was added.

    Please feel free to colaborate.

    Wojciech Sciesinski

  17. Anonymous says:

      ** Newly updated to include 2012 R2 Best Practices. See 11/03/2013 blog regarding R2 updates by

  18. Lord Melch says:

    Cracking work thanks 🙂

  19. jafar says:

    Hi, Can we get the PS for win 2012 R2 servers? Jafar

  20. Ivo says:

    Is there a 2012 R2 version available?

  21. PnoT says:

    it’s been a while since this has been updated even on github

  22. Anonymous says:

    Hey there,
    If you were aware of my most excellent friend Cristian Edwards’ Hyper-V and Failover

  23. Hiram Celis - MSFT (PFE) says:

    Thanks Cristian. Very useful, because the script structure could be used or updated editing the xml and be used as a recurrent operational task with other critical updates.

  24. David says:

    Are the XML’s up to date at present? (2015-04-25)

  25. Erick Perez says:

    Does this script works against Win 2012 R2 or just plain 2012?

Comments are closed.

Skip to main content