Trond's Working!

Ramblings about computers.

PowerShell script: Check that hotfix levels are equal across Hyper-V Cluster nodes

Published / by Trond / 1 Comment on PowerShell script: Check that hotfix levels are equal across Hyper-V Cluster nodes

Sure, you can use VMM baselines for this, but just in case you haven’t integrated WSUS with VMM yet:

Vniklas (https://twitter.com/vNiklas) made a nice addition to the “Check for recommended hotfixes” script which lets you quickly scan your hyper-V cluster for recommended hotfixes. I took it a small step further by adding another script which lets you validate that these hotfixes are evenly applied across nodes in your cluster. Here’s what you do:

1. Download and rund Niklas’ script, like this:

$updatelist  =.\HyperV2012UpdatesCheck.ps1 -ClusterName JHSHVCL01

Then, save the script below as “ValidateHotfixLevels” and run it with the updatelist as parameter:

.\ValidateClusterHotfixLevels.ps1 $updatelist

And it should report back to you any diffs within your cluster. Pretty neat!

Here’s the script. Save it as ValidateClusterHotfixLevels.ps1:

param
(
    [parameter(ValueFromPipeline=$true,  
                   Position=0)]
    [array]$UpdateList
)



$UniqueUpdates = $UpdateList | select RecomendedHotfix -Unique

foreach ($update in $UniqueUpdates)
    {
        $nodeupdate = $updatelist | where {$_.RecomendedHotfix -eq $update.RecomendedHotfix}
        $statuscheck = @()
        $Statuscheck += $nodeupdate | select Status -Unique
        if ($statuscheck.count -gt 1)
            {
                Write-warning "Update $($update.RecomendedHotfix) is not equal across cluster nodes"
                foreach ($nodeupdateEntry in ($nodeupdate))
                    {
                        Write-Warning "       $($NodeupdateEntry.HyperVNode): $($NodeUpdateEntry.RecomendedHotfix) $($NodeupdateEntry.Status)"
                    }
            }
        $Statuscheck = $null
        
    }

Looks like I got some patching to do…

2013-06-28 12_42_35-JHSVMMGMT02 - Remote Desktop Connection Manager v2.2