This SMA runbook solution can be leveraged to update (exchange) the SCVMM DHCP Server Agent extension on Hyper-V managed Hosts
which has been updated with System Center 2012 R2 UR3, UR4 and UR5.
This solution uses Powershell DSC to remove the recent agent and to install the new one.

The runbook I created performs the following steps

To reduce the complexity for other users of the runbook I've included the DSC config data in the runbook, whereas ususually separating the config data from the logic.

 

PowerShell Workflow
Skript bearbeiten|Remove
v<# 
.SYNOPSIS 
Update-VMHostDHCPAgent 
Written by Michael Rüefli 
 
 
.DESCRIPTION 
This SMA runbook solution can be leveraged to update (exchange) the SCVMM DHCP Server Agent extension on Hyper-V managed Hosts 
which has been updated with System Center 2012 R2 UR3 
This solution uses Powershell DSC to remove the recent agent and to install the new one. 
 
.PARAMETER VMHostName 
 
If specified only a single host (the one specified) is updated 
 
.EXAMPLE  
 
Update-VMHostDHCPAgent -VMHostName HYPV001 
 
Updates the Agent on a single Hyper-V Host. If no parameter is specified all hosts are updated 
 
.NOTES 
 
The following SMA assets must be present in SMA 
   "VARG-SCVMMServer" (SCVMM Server Name) 
   "CREDVMMAdmin" (PS Credential for SCVMM connection) 
   "CREDHostAccessFabric" (PS Credential for Hyper-V Host WinRM connection) 
   "VARG-SWShare" (Software repository share location) 
 
 
.LINK 
http://www.miru.ch 
#> 
 
Workflow Update-VMHostDHCPAgent 
{ 
    param( 
    [PARAMETER(mandatory=$false)] 
    [STRING]$VMHostName 
    ) 
     
    #$VerbosePreference = "continue"  #remove the comment to activate verbose output in testing mode 
     
    #Get SMA Assets 
    $VMMServer = Get-AutomationVariable -Name "VARG-SCVMMServer" 
    $VMMCred = Get-AutomationPSCredential  -Name "CREDVMMAdmin" 
    $HostManagementCred = Get-AutomationPSCredential -Name "CREDHostAccessFabric" 
    $SWShare = Get-AutomationVariable -Name "VARG-SWShare" 
    $AgentInstaller = "$SWShare\SCVMM\SCVMM\Updates\DHCPExtn.msi" 
     
    #Get VMHosts from SCVMM 
    $VMHosts = InlineScript { 
        Try 
        { 
            $vmmconnection = Get-SCVMMServer -ComputerName $USING:VMMServer 
            If ($USING:VMHostName) 
            { 
                Write-Verbose "Getting single host: $USING:VMHostName" 
                (Get-SCVMhost $USING:VMHostName | Select Name).Name 
            } 
            Else 
            { 
                Write-Verbose "Getting all hosts" 
                (Get-SCVMhost | Select Name).Name 
            } 
        } 
        Catch 
        { 
            Write-Verbose $_.Exception.Message 
            Throw "An error occured getting hosts from SCVMM" 
        }         
    }  
     
 
    #Set the Output Path for local DSC Mof resources 
    $DSCConfigPath = "C:\DSCConfigs\HyperVSCVMMDHCPAgent" 
    #Remove all previous Mof files 
    Try 
    { 
        Get-ChildItem -Path $DSCConfigPath -Filter "*.mof" | Remove-Item -Force 
    } 
    Catch {} 
         
    #We use an inline script for the DSC Configuration Part 
    InlineScript 
    { 
        $VerbosePreference = [System.Management.Automation.ActionPreference]$Using:VerbosePreference 
        
        Configuration HyperVSCVMMDHCPServer 
        { 
            param ( 
            [Parameter(Mandatory=$true)] 
            [ValidateNotNullOrEmpty()] 
            [String[]]$NodeName  
            ) 
             
            #Rescope the Vars 
            $SWShare = $USING:SWshare 
            $DPMServer = $USING:DPMServer 
  
            #Define DSC Configuration 
            Node $NodeName 
            {              
 
                #Old DHCP Server Agent 
                Package DHCPServerAgentOld 
                { 
                    Name = "Microsoft System Center Virtual Machine Manager DHCP Server (x64)" 
                    Path = "$USING:AgentInstaller" 
                    ProductId = "3834A905-5CC1-454D-8CA4-AC449F12775D" 
                    Ensure = "Absent" 
                    ReturnCode = 0 
                } 
                 
                #New DHCP Server Agent 
                Package DHCPServerAgentNew 
                { 
                    Name = "Microsoft System Center Virtual Machine Manager DHCP Server (x64)" 
                    Path = "$USING:AgentInstaller" 
                    ProductId = "293283BA-18C5-435F-BE53-554BA0D38A6E" 
                    Arguments = "/q" 
                    Ensure = "Present" 
                    DependsOn = "[Package]DHCPServerAgentOld" 
                    ReturnCode = 0 
                }              
 
            } 
        }      
 
        Write-Verbose "Creating DSC MOFs in Path: $USING:DSCConfigPath" 
        #Create the DSC Mof files for each Worker 
        HyperVSCVMMDHCPServer -NodeName $USING:VMHosts -OutputPath $USING:DSCConfigPath 
 
        #Run the DSC Configuration 
        Write-Verbose "Deploying DSC Configuration" 
        Start-DscConfiguration -Path $USING:DSCConfigPath -wait -Force -verbose -Credential  $USING:HostManagementCred 
    } 
}