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 : http://social.technet.microsoft.com/wiki/contents/articles/15576.hyper-v-update-list-for-windows-server-2012.aspx
Also, the same Powershell script detects if the Failover Cluster 2012 updates listed on this KB article are installed http://support.microsoft.com/kb/2784261. 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. http://social.technet.microsoft.com/wiki/contents/articles/15577.list-of-failover-cluster-hotfixes-for-windows-server-2012.aspx, 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
And here you have the code in case you want to take a look before running it.
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)
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)
30: $witness = 0
31: foreach($hotfix in $Hotfixes)
33: If($RecomendedHotfix.id -eq $hotfix.HotfixID)
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
43: if($witness -eq 0)
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 "--------------------------"
54: Write-Host "Listing Failover Cluster 2012 Hotfixes" -ForegroundColor Yellow
56: foreach($RecomendedClusterHotfix in $ClusterHotfixes)
58: $witness = 0
59: foreach($hotfix in $Hotfixes)
61: If($RecomendedClusterHotfix.id -eq $hotfix.HotfixID)
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
71: if($witness -eq 0)
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 "--------------------------"
Excellent work, Cristian!! Very useful!
Cristian, I just updated the list of Hyper-V hotfixes on the wiki page. Have a look; probably need to make some XML updates :)
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...
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?
Sorry, I post my question 5 minutes later without refresh and Anatoly post the same :-)
I have upload the zip file again that includes the XML files. Please check it again.
Thanks! I thought I was taking crazy pills, no XMLs
Very good script. Thanks a lot.
Thanks Cristian for sharing your knowledge and for the useful script :-)
Great script, I have added some object and download stuff in this
keep up the good work!
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 social.technet.microsoft.com/.../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!
Could you tell me how to update the xml files so we can do this manually and avoid waiting for your updates?
Does your script check for updates applicable to Windows Server 2012 R2?
Windows Server 2012 R2 will have no hotfixes at the moment