Cristian Edwards

A piece of virtualization with Hyper-V and SCVMM

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

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

  • Comments 6
  • Likes

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. http://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)

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
  • A must have for clusters

    You make my life easier

    thx Carlos

  • 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

  • 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?

  • And please also integrate blog.atwork.at/.../Hyper-V-Cluster-updaten.aspx

  • do you have a version for Windows 2012 R2 ?

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

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment