PowerShell Scripts VMware vSphere

Change HA settings for virtual machines using Powershell

Using this small script it is possible to change the HA settings for multiple virtual machines in an HA cluster.


– multiple virtual machines all with Name XXX-console

HA restart policy possible values:


Connect-VIServer -Server VCENTER-IP -User USER -Password PASSWORD

$Cluster = "CLUSTERNAME"
$vms = Get-VM -Location $Cluster -Name "*-console" | sort

foreach ($vm in $vms) {
	Write-Host $vm
	$result = $vm | Set-VM -HARestartPriority:Low -Confirm:$false

Disconnect-VIServer -Server VCENTER-IP -Force:$true -Confirm:$false

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.