LucD
Leadership
Leadership

You could do something like this

$vm = Get-VM -Name MyVM

$rp = Get-ResourcePool -VM $vm

Remove-VM -VM $vm -DeletePermanently:$false -Confirm:$false

New-VM -VMFilePath $vm.ExtensionData.Config.Files.VmPathName -ResourcePool $rp -Confirm:$false


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

Reply
0 Kudos