@Kim_Bottu … Virtually Gung Ho
#1. Script puts $Host in Maintenance mode.
#2. Script moves the specific VM’s to a specific host called $Destination
#3. Script will create a backup of the ESXi configuration of host $Host to C:\HostBackups
# If the script seems to hang, tap the space bar, the script will continue.
# Change the name of $VMHost, $Destination and the reference to the specific VM’s (VMSpecial*) in the script.
$VMHost = host1.esxi.local
$Destination = host2.esxi.local
#1. Script puts Host in Maintenance mode.
Write-host Put Host in Maintenance mode and allow the execution of code while the host is still not in maintenance mode.
$task = Set-VMHost -VMHost $VMHost -State “Maintenance” -RunAsync
#2. Move the specific VM’s to specific $Destination
Get-VM -Name VMSpecial* | Move-VM -Destination $Destination
write-host SPecific VM’s have been moved
#3. Back up ESXi configuration to C:\HostBackups
Write-Host “Backing up ESXi config to C:\HostBackups”
Get-VMHostFirmware -VMHost $VMHost -BackupConfiguration -DestinationPath C:\HostBackups
Write-Host “Backup is completed!”