Some weeks ago Microsoft released Update Rollup 3 for System Center 2012 R2. Part of this RU, SCVMM components also got updated. This time, unfortunately it was not sufficient to update the SCVMM Server / Console components and to execute the post-update SQL script. Microsoft has also updated the SCVMM DHCP Agent extension running on all managed Hyper-V hosts. The KB article states to manually check for a recent version and update it.
Of course this is not what you wanna do on dozens of hosts. As soon as I thought about the update procedure, Powershell DSC (Desired State Configuration) came into my mind again. Combined with Service Management Automation (SMA) DSC is a very powerful feature. In a recent blog post I showed how I’m using the combination to keep SMA Runbook workers up to date with additional packages and external modules.
This time I just want to exchange the VMM DHCP Agent extension on all managed Hyper-V hosts. Therefore I’ve created a SMA runbook. You might think of a bit an overkill to create an SMA runbook for this “hopefully” one-time task. However I tend to create a Powershell workflow for almost everything, because I might need the scripted actions somewhere in a SMA runbook later.
The runbook I created performs the following steps
- Gets the required Assets from SMA (Variable and Credentials) which are:
– SCVMM Server Name
– PS Credential for SCVMM connection
– PS Credential for Hyper-V Host WinRM connection
– Software repository share location
- Connects to SCVMM and reads out all Hyper-V Hosts
- Creates a DSC Configuration for each host
- Applies the DSC configuration which in fact removes the old DHCP Agent and installs the new one
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.
Where to get it
You can find a copy of the runbook on TechNet.
Hope this helps you to save some time tooo…