LucD
Leadership
Leadership

Is your DRS set to automatic mode?
If yes, the VMs should be vMotion-ed when you set the host to maintenance mode with the Set-VMHost cmdlet.

If not, can you set the DRS mode temporarily to FyllyAutomated with the Set-Cluster cmdlet?

$esxName = 'MyESX'

$cluster = Get-Cluster -VMHost $esxName

if($cluster.DrsAutomationLevel -ne 'FullyAutmated'){

    Set-Cluster -Cluster $cluster -DrsAutomationLevel FullyAutomated -Confirm:$false

}

Set-VMHost -VMHost $esxName -State Maintenance -Confirm:$false

Or is it something completely different you want to do?


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