VMware Cloud Community
tdubb123
Expert
Expert

script to clone VM and export to ova

I am trying to clone a running VM to a clone and then export it to a ova and then remove the clone as a backup solution

I got the command lines but trying top put a script together

new-vm -Name centos-test-clone -VM centos -DiskStorageFormat Thin -Confirm:$false -VMHost (get-vmhost -Location (get-datacenter "xxx") | get-random)

New-PSDrive -Name "z" -PSProvider FileSystem -Root "\\networkshare\backups"

Export-VApp -VM centos-test-clone -Destination "z" -Format Ova

Remove-VM -VM centos-clone-test -Confirm:$false

remove-psdrive -name Z -confirm:$false

any idea?

0 Kudos
1 Reply
LucD
Leadership
Leadership

Not too sure what you want to achieve, you seem to have all the required commands.


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

0 Kudos