VMware Cloud Community
ChPrakash
Contributor
Contributor

Remediate VM through update manager on reboot

Hi,

We are performing windows server patching and would  like to upgrade vm tools and hardware during the maintenance window when  we reboot the servers. I have created a baseline group with tools and  vm hardware update baselines. I've written a quick powershell script  which collects the intial details for the VM and remeidiates the VMs  against the baselines and get the final status of the VM. However this  script as to be run explicitly after server patching from a vCenter  server or some machine where the vmware update manager snapin is  installed. Given that each server is patch at different timelines we  have to run the script for each server after patching. I would to find a  way to automatically initiate the remediation of the VM on reboot so  that whenever the server is patched and rebooted, vm remidiation is  initiated and administrator need to run the script and wait for the vm  to remidiate and get the final status.

I know that this is posible for vmtools. We can enable  'check and upgrade tools during power cycling' option for VM and upgrade tools on reboot but do we have something similar for hardware upgrade or to remidiate the vm on reboot?

-Prakash

0 Kudos
3 Replies
vmroyale
Immortal
Immortal

Note: Discussion successfully moved from VMware vCenter™ Server to vCenter Update Manager PowerCLI

Brian Atkinson | vExpert | VMTN Moderator | Author of "VCP5-DCV VMware Certified Professional-Data Center Virtualization on vSphere 5.5 Study Guide: VCP-550" | @vmroyale | http://vmroyale.com
0 Kudos
RvdNieuwendijk
Leadership
Leadership

Hi Prakash,

I don't think you can schedule a vm for remediation on reboot. But in vSphere 5.1 you can schedule a vm for hardware upgrade with:

$vm = Get-VM -Name MyVM
$spec = New-Object -TypeName VMware.Vim.VirtualMachineConfigSpec
$spec.ScheduledHardwareUpgradeInfo = New-Object -TypeName VMware.Vim.ScheduledHardwareUpgradeInfo
$spec.ScheduledHardwareUpgradeInfo.UpgradePolicy = "onSoftPowerOff"
$spec.ScheduledHardwareUpgradeInfo.VersionKey = "vmx-09"
$vm.ExtensionData.ReconfigVM_Task($spec)

The above script will schedule a vm called MyVM for an upgrade to hardware version 9 on a soft power off.

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos
LucD
Leadership
Leadership

You could create an alarm that monitors for the VmGuestRebootEvent event.

When the alarm is triggered, you could start a script that handles the VMware Tools upgrade and the HW upgrade.

See vSphere alarm triggers for more info on how to do this.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos