Virtual Machine Guest + Host Update and Reboot Sequence Automation

Today I want to take some time to address a common scenario for administrators of virtual machine environments. In the most recent release of BatchPatch we added a new feature called the ‘Advanced multi-row queue sequence,’ which allows the BatchPatch administrator to create more complex update and reboot sequences than were previously possible. One example of where this can really come in handy is for virtual machine environments.

Imagine for a moment that you have a Hyper-V host with a dozen virtual machine guests running on it. When Microsoft ‘Patch Tuesday’ arrives, you want an easy way to update all of the virtual machines and then update the physical VM host, and then finally reboot the VM host. Not only that, but you want to do it by launching a single task that will take care of the entire process so that you don’t have to pay attention to each step along the way. The new ‘Advanced multi-row queue sequence’ in BatchPatch let’s you do exactly that.

For this example, we’ll use the BatchPatch ‘Advanced multi-row queue sequence’ to create and then execute a sequence to download and install Windows Updates on all of the virtual machine guests on a particular virtual machine host. And then as soon as the updates have been installed on all guests, the host will be automatically triggered to download and install updates plus reboot.

  1. To get started let’s select all of the VM guests on Hyper-V_HOST1.
    2015-03-23 16_12_16-new 1 - BatchPatch X8
  2. Next select ‘Actions > Job Queue > Create/modify advanced multi-row queue sequence.’ In the ‘Advanced Multi-Row Queue’ window we have to now choose a name for our sequence, and we have to specify the position number of each host/guest that will participate in it. In the screenshot below you can see that I’ve called the sequence ‘Hyper-V_Sequence1’ and I’ve applied position number 1 value to all of the VM guests, with the VM host getting position number 2. What this means is that when we eventually execute the sequence, all position number 1 rows will execute simultaneously, and then BatchPatch will wait for them to complete. Once all position 1 rows are done, the position 2 row will begin execution. The sequence name is used to determine which rows are participating in a given sequence. If you apply the same sequence name to all rows, then all rows will be included in the same sequence. If you want to have multiple different sequences in a single grid, no problem. To do that you simply need to apply a different sequence name along with appropriate position numbers to each group of hosts.
    2015-03-23 16_15_27-new 1 - BatchPatch X8
  3. Now that we’ve set the sequence name and position numbers, we have to configure the actual action that each row will execute when the sequence is launched. To do this, we select all of the VM guest rows and then go to ‘Actions > Job Queue > Create/modify job queue.’ In the job queue window we’ll select ‘Download and install updates.’ Then we click ‘Apply queue to row(s) without executing.’ Lastly, we select the VM host row and apply a queue to it as well. However, in this case we’ll apply ‘Download and install updates + reboot always.’
    2015-03-23 16_20_10-Job Queue
    We end up with something like this:
    2015-03-23 16_21_30-new 1 - BatchPatch X8
  4. We’re almost done with the setup. The last thing we need to do is create an ‘Execution row’ for the sequence. This is a special row that we designate to enable us to actually launch the sequence. The host name that we specify for the row doesn’t actually matter, but for the sake of clarity I’ve created a new row ‘Hyper-V_Sequence1_ExecutionRow’ in the ‘Host’ field.
  5. 2015-03-23 16_25_19-new 1 - BatchPatch X9

  6. The final step is to execute the sequence. In this example we’ll launch the sequence manually, but you can just as easily launch the sequence at a specific time and date using the ‘Task Scheduler.’ To launch the sequence on-demand, highlight the ‘Execution Row’ and then select ‘Actions > Job Queue > Execute advanced multi-row queue sequence.’ The ‘Confirm Action’ prompt appears and tells us exactly what is about to happen. When we click ‘OK,’ the job queue that we specified for each row in the grid that contains the sequence name ‘Hyper-V_Sequence1’ will be executed in the order that we specified, which now appears in the ‘Advanced Multi-Row Queue’ column. In this instance that means all of the VM guests will download and install updates. When they are all finished, the VM host will then download and install updates plus reboot.
    2015-03-23 16_30_08-new 1 - BatchPatch X9
This entry was posted in Blog, General, Tutorials and tagged , , , . Bookmark the permalink. Both comments and trackbacks are currently closed.