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

Hello again!

During the last week I did some test with the script and I realize that is not handy to type a bunch of server names when you need to analyze big Clusters, so i decided to create a V2 of the script specifically for Clusters. I think this will like to lazy people like me that hates to type 16 servers names when all of them belong to the same cluster.

This V2 script only requires the name of the 2012 Hyper-V Cluster you want to analyze and automatically will collect the hotfixes from all nodes and will compare with the list already mentioned in my last post. https://blogs.technet.com/b/cedward/archive/2013/05/24/validating-hyper-v-2012-and-failover-clustering-2012-hotfixes-and-updates-with-powershell.aspx

Here is the V2 script that only requires the Cluster Name

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

June 22h 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)

HyperVCluster2012UpdatesCheck.zip

And here is the code. Enjoy!

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

Comments

  • Anonymous
    June 24, 2013
    A must have for clusters You make my life easier thx Carlos

  • Anonymous
    June 27, 2013
    I have customized your script and xml files a bit and posted on my blog to create powershell objects and possible download the updates/hotfixes :-) vniklas.djungeln.se/.../hotfix-and-updates-check-of-hyper-v-and-cluster-with-powershell

  • Anonymous
    September 20, 2013
    Any chance you could put URLs up for just the 2 XML files so that a script could pull them down and make sure it's the latest one?

  • Anonymous
    September 27, 2013
    And please also integrate blog.atwork.at/.../Hyper-V-Cluster-updaten.aspx

  • Anonymous
    December 17, 2013
    do you have a version for Windows 2012 R2 ?

  • Anonymous
    January 20, 2014
    a version for 2012R2 would be really nice :) Keeping up with the hotfixes is a real PITA, so your work here is really appreciated