Recently I received a request to disable any automated HA actions on specific VMs across our infrastructure. To some folks that might sound a bit crazy, but there was good reason: an outside vendor supports an application and wanted to be involved any time the VM was powered up/down/etc. They have contractual obligations with business units within our company, and wanted to be sure that their application stack was started in an application-graceful way.
In order to meet these needs, I needed an easy way to adjust HA isolation responses and VM restart policies on a per-VM level. (I also needed a way to adjust the VM Tools monitoring on a per-VM level, but I’ll save that for another post and that can be found here.)
[powershell]
Get-VM *vmname* | % {Set-VM $_.Name -HAIsolationResponse:DoNothing -HARestartPriority:Disabled -Confirm:$false -RunAsync:$true}
[/powershell]
In the first bit of the script, we’re grabbing all virtual machines that contain “vmname”. Then we pass those results to the % (which is a PowerShell alias for For-Each, which performs an operation on each input object). The operation performed is to set the HA Isolation Response to DoNothing (or Leave Powered On, in the vSphere client GUI), and to set the HA Restart Priority to Disabled. The Confirm parameter is there to prevent the script from prompting for confirmation on each operation, and the RunAsync parameter will complete everything in parallel instead of one at a time.
I hope this has been helpful.
[…] About « VMware HA Restart Policies: PowerCLI […]