Although you can import and export virtual machines from and to a VMware ESXi hypervisor from its web interface, you can also do it from the command line using the VMware OVF Tool (ovftool).
In our case, we have a "Win 10 v2004 x64" virtual machine on our VMware ESXi hypervisor.
To do this, go to the VMware site and log in with your VMware account.
If you don't have one yet, create one for free and connect with it.
Then, download the zip version of this tool : VMware OVF Tool (ovftool).
Once the zip file has downloaded, unzip it.
Go into the folder that appears, then in the "ovftool" subfolder.
In this subfolder, you will find the "ovftool.exe" program.
To use this tool, open a command prompt (cmd.exe) and navigate to the folder where this "ovftool.exe" file is located :
Batch
cd C:\Users\user\Downloads\VMware-ovftool-4.4.3-18663434-win.x86_64\ovftool
Then, to get the list of virtual machines present on your VMware ESXi hypervisor, type the command below.
Parameters used :
Batch
ovftool.exe --noSSLVerify "vi://10.0.0.5/"
Log in as root :
Plain Text
Enter login information for source vi://10.0.0.5/ Username:
Once authenticated, this will be displayed.
As you can see, in our case, VMware OVF Tool tells us that a "Win 10 v2004 x64" virtual machine is present on our VMware ESXi hypervisor.
Plain Text
Enter login information for source vi://10.0.0.5/ Username: root Password: *********** Error: Found wrong kind of object (ResourcePool). Possible completions are: Win 10 v2004 x64
To obtain information about this virtual machine, all you have to do is add its name at the end of the "vi://.../" parameter.
Batch
ovftool.exe --noSSLVerify "vi://10.0.0.5/Win 10 v2004 x64"
Which will look like this :
Plain Text
... OVF version: 1.0 VirtualApp: false Name: Win 10 v2004 x64 ... Virtual Machines: Name: Win 10 v2004 x64 Operating System: windows9_64guest Virtual Hardware: Families: vmx-14 Number of CPUs: 8 Cores per socket: 8 Memory: 16.00 GB ...
To export a virtual machine from your VMware ESXi hypervisor using VMware OVF Tool, you must know the address of your VMware ESXi hypervisor and the name of the virtual machine to export.
In our case :
Here is the virtual machine that we are going to export.
In the command prompt, type the command below.
Parameters used :
Batch
ovftool.exe --noSSLVerify "vi://10.0.0.5/Win 10 v2004 x64" "C:\Users\user\Downloads\Win 10 v2004 x64.ovf"
Log in as "root" as before :
Plain Text
Enter login information for source vi://10.0.0.5/ Username:
Once logged in as root, this will be displayed :
Plain Text
Enter login information for source vi://10.0.0.5/ Username: root Password: *********** Opening VI source: vi://root@10.0.0.5:443/Win%2010%20v2004%20x64 Opening OVF target: C:\Users\user\Downloads\Win 10 v2004 x64.ovf Writing OVF package: C:\Users\user\Downloads\Win 10 v2004 x64.ovf Disk progress: 10%
On your hard drive, you will see that a ".tmp" file is being created.
In our case, an iso file was in the virtual CD/DVD drive of this virtual machine.
This file is therefore also exported from our VMware ESXi hypervisor.
If you open the "Recent tasks" panel of your VMware ESXi hypervisor, you will see that an "Export Vm" task is running for the virtual machine you are exporting to your computer via VMware OVF Tool.
Once the virtual machine export is complete, this message will appear in the command prompt :
Plain Text
Transfer Completed Completed successfully
In the recent tasks of your VMware ESXi hypervisor, you will see that the "Export Vm" task is complete.
On your hard drive, you will see that the exported virtual machine is composed of :
To import a virtual machine in OVF format to your VMware ESXi hypervisor, use the command below.
Parameters used :
Batch
ovftool --noSSLVerify -ds="RAID Vol" -n="Win 10 v2004 x64 Bis" "C:\Users\user\Downloads\Win 10 v2004 x64.ovf" vi://10.0.0.5/
If a ".mf" manifest file is present in the same folder as the OVF configuration file ".ovf" that you specified in the above command, VMware OVF Tool will check the integrity of the files of the virtual machine before import it.
Hence the appearance of the "The manifest validates" message.
Then, authenticate yourself (as before) and this will appear :
Plain Text
Opening OVF source: C:\Users\user\Downloads\Win 10 v2004 x64.ovf The manifest validates Enter login information for target vi://10.0.0.5/ Username: root Password: *********** Opening VI target: vi://root@10.0.0.5:443/ Deploying to VI: vi://root@10.0.0.5:443/ Disk progress: 9%
While importing your virtual machine, you will see an "Import VApp" task appear in the recent tasks of your VMware ESXi hypervisor.
Once the import is complete, this will be displayed :
Plain Text
Transfer Completed Completed successfully
In the web interface of your VMware ESXi hypervisor, you will see that the "Import VApp" task is complete.
The virtual machine has been imported.
In our case, an ISO file was linked to this virtual machine.
It was therefore reimported with the virtual machine and stored in the folder of this virtual machine.
To check this, you can also use the datastore browser.
Thanks to VMware OVF Tool, you will also be able to export and import virtual machines using the OVA format instead of OVF.
The technique to use remains the same, except that you will need to use the file extension ".ova" instead of ".ovf" in the commands explained previously.
To summarize, to export the virtual machine in OVA format, use this command :
Batch
ovftool.exe --noSSLVerify "vi://10.0.0.5/Win 10 v2004 x64" "C:\Users\user\Downloads\Win 10 v2004 x64.ova"
Which will display this in the command prompt :
Plain Text
Enter login information for source vi://10.0.0.5/ Username: root Password: *********** Opening VI source: vi://root@10.0.0.5:443/Win%2010%20v2004%20x64 Opening OVA target: C:\Users\user\Downloads\Win 10 v2004 x64.ova Writing OVA package: C:\Users\user\Downloads\Win 10 v2004 x64.ova Disk progress: 10%
If you open file explorer on your computer, you will see that only one ".ova" file is being created.
Indeed, in OVA format, everything is contained in the same file.
On your VMware ESXi hypervisor, the task that will appear remains the same : Export Vm.
Once the virtual machine has been exported in OVA format from your VMware ESXi hypervisor, this will be displayed :
Plain Text
Transfer Completed Completed successfully
In the web interface of your VMware ESXi hypervisor, you will see that the "Export Vm" task is complete.
On your hard disk, you will find a single ".ova" file (which will be larger or smaller depending on the current size of the hard disk(s) of the exported virtual machine).
To import the virtual machine from the OVA format, the principle is the same as for the OVF format, except that the source file will be an ".ova" file instead of ".ovf".
Which gives this command :
Batch
ovftool --noSSLVerify -ds="RAID Vol" -n="Win 10 v2004 x64 Bis" "C:\Users\user\Downloads\Win 10 v2004 x64.ova" vi://10.0.0.5/
Once this command is executed, authenticate and this will be displayed :
Plain Text
Opening OVA source: C:\Users\user\Downloads\Win 10 v2004 x64.ova The manifest validates Enter login information for target vi://10.0.0.5/ Username: root Password: *********** Opening VI target: vi://root@10.0.0.5:443/ Deploying to VI: vi://root@10.0.0.5:443/ Disk progress: 97%
Once the import is complete, this will show in the command prompt :
Plain Text
Transfer Completed Completed successfully
On your VMware ESXi hypervisor, you will see that the "Import VApp" task will be completed.
As before, the virtual machine appears on your VMware ESXi hypervisor.
And the file linked to it will also be imported and stored in its folder (if applicable).
VMware 11/4/2022
VMware 10/14/2022
VMware 8/19/2022
VMware 9/7/2022
Pinned content
Contact
® InformatiWeb-Pro.net - InformatiWeb.net 2008-2022 - © Lionel Eppe - All rights reserved.
Total or partial reproduction of this site is prohibited and constitutes an infringement punishable by articles L.335-2 and following of the intellectual property Code.
You must be logged in to post a comment