Hi All,
I want to perform bulk removal/unregister of VM's from source environment vsphere host 6.0 and Register/add that VM's to the swing host ESXi 7.0. for migration purpose.Steps will like
1) Shut down all the VM's gracefully from C:\temp\VMliste
2) Remove VM's from inventory or unregister from source environment i.e. ESXi 6.0 and Register/add that VM's to the swing host ESXi 7.0. for migration purpose. C:\temp\vmliste ( For unregister and registering)
is it possible from power cli to perform this task to reduce the downtime ? Any help will appreciated.
Thanks
Vmk
Have you searched this area for examples of code for the 3 steps you wish to carry out?
1. Shutdown
2. Unregister
3. Register
Thanks Scott,
I can perform first step 1 i.e. shutdown bulks VM's using the script
# Part 1
$vmNames = Get-Content -Path .\vmnames.txt
$vms = Get-VM -Name $vmNames |
where{$_.PowerState -eq 'PoweredOn'}
Shutdown-VMGuest -VM $vms -Confirm:$false
while((Get-VM -Name $vmNames).PowerState -contains 'PoweredOn'){
sleep 5
}
$vms | Select Name | Export-Csv -Path .\vm-powered-off.csv -NoTypeInformation -UseCulture
Part 2
https://www.miru.ch/bulk-unregister-register-vms-on-vsphere
But i'm looking for specific list of VM's spread across the cluster
# Part 4
$vmNames = Import-Csv -Path .\vm-powered-off.csv -UseCulture
Get-VM -Name $vmNames.Name |
Start-VM -Confirm:$false
