Hi,

 

recently, I updated my SCVMM Lab Environment with UR3. http://support.microsoft.com/kb/2965414

Usually, I expected that my hosts would report that they need attention and a Host Agent update would be required. As this did not happen, I wrote below script to verify the latest Agents are installed, and optionally offer to do the update.

Please note that before doing the update, you should take the usual precautions to prepare for Host and VM Downtime. Also, you need to have Execution Policy set to allow running PS scripts.

 

Copy and paste below script into checkagentversion.ps1

#-----------------------------------
# Check Version of VMM Host agents
#-----------------------------------

$vmmserver = get-scvmmserver -ComputerName "localhost"
Write-Host "SCVMM Server Version"  $vmmserver.ProductVersion

$version = $vmmserver.ProductVersion
$outdated = 0

$ManagedHosts = Get-SCVMMManagedComputer

foreach ($Managedhost in $managedHosts)
{

    if ($version -eq $Managedhost.AgentVersion)
    {
        write-Host $Managedhost.ComputerName $Managedhost.AgentVersion
    }
    else
    {
        write-Host $Managedhost.ComputerName $Managedhost.AgentVersion -ForegroundColor Red
        $outdated = 1
    }
}

if ($outdated -eq 1)
{
    write-host
    Write-Host "Some Managed Hosts have not the latest agent installed"-ForegroundColor Red
    Write-Host "Warning: Updateing now may cause downtime to the Host and the running VMs"-ForegroundColor Red
    $message= "Do you want to update hosts now.?"
    $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes",""
    $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No",""
    $choices = [System.Management.Automation.Host.ChoiceDescription[]]($yes,$no)
    $result = $Host.UI.PromptForChoice("Update All Hosts with latest Agent",$message,$choices,0)

    # Do the update

    if($result -eq 0)
    {
   
       $Credential = Get-Credential
       foreach ($Managedhost in $managedHosts)
       {
            if ($version -ne $Managedhost.AgentVersion)
            {
            Write-Host "Updating "  $Managedhost.ComputerName
            $VMMManagedHost = Get-SCVMMManagedComputer -ComputerName $Managedhost.ComputerName
            $result=Update-SCVMMManagedComputer -VMMManagedComputer $VMMManagedHost -Credential $Credential
           
            }
       }
   
    }

}
else
{
    write-Host "Agents on managed computers are up to date"
}

# End of script

 

 

Additionally, if you are using Network Virtualization check out this blog to ensure having the latest DHCP extenions. http://blogs.technet.com/b/scvmm/archive/2014/07/31/support-tip-vms-deployed-to-hyper-v-networks-experience-delays-acquiring-an-ip-address-after-reboot.aspx

Hope this helps

Cheers

Robert