After upgrading to VMWare ESXi 6.7, I noticed that you cannot export a VM to OVA anymore (from the GUI).
So… PowerCli to the rescue…
First we need the PowerShell Module (More info here: https://www.powershellgallery.com/packages/VMware.PowerCLI/10.0.0.7895300) , and, of course, PowerShell (version 5 recommended).
We install the module: Install-Module -Name VMware.PowerCLI -RequiredVersion 10.0.0.7895300
Then, here’s the script to do it:
1 2 3 4 5 6 7 8 9 |
Import-Module VMware.PowerCLI Set-PowerCLIConfiguration -InvalidCertificateAction Ignore Connect-VIServer -Server vcenter.pbnet.local $csvfile="C:\TORR\exp\VMs.csv" $csvdata=Import-Csv $csvfile foreach ($line in $csvdata) { Get-VM -Name $line.name | Export-VApp -Destination "c:\torr\exp" -CreateSeparateFolder -Format Ova } |
Now here’s how the table should look like (VMs.csv file)
Name |
---|
VM1 |
VM2 |
Note that if you have an ISO file attached to the VM, it will also be exported.