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
Not too sure what you want to achieve, you seem to have all the required commands.