ovftool

OVFTOOL

convert local vmx to vsphere:
$ ovftool -ds=ntnx1 -n=vm1 -nw="VM Network" CentOS.vmx vi://root:[email protected]/Datacenter/host/Cluster/
Opening VMX source: CentOS.vmx
Opening VI target: vi://[email protected]:443/Datacenter/host/Cluster/
Deploying to VI: vi://[email protected]:443/Datacenter/host/Cluster/
Transfer Completed                    
Completed successfully

convert ova to vmx
$ ovftool -tt=vmx xvm1.ova . 

convert vm from esx to local (VM Power off )
$ ovftool  vi://root:[email protected]/Datacenter/host/Cluster/Resources/vms/gw . 



refer:
http://fosshelp.blogspot.com/2013/06/how-to-use-ovftool-command-line-utility.html

How to use ovftool command line utility

1)
To see all VMs in the ESXi Server 192.168.1.26
#ovftool vi://192.168.1.26

2)
To get the ovf of VM demovm1
#ovftool vi://192.168.1.26/demovm1 ~/Desktop/ovfs/
#ovftool vi://root:[email protected]/demovm1 ~/Desktop/ovfs/



3)
To get the ovf of VM vcenter2, poweroff VM before taking ovf
#ovftool --powerOffSource vi://root:[email protected]/vcenter2 ~/Desktop/ovfs/

4)
To get the ovf of VM using moref "238"
#ovftool vi://root:[email protected]?moref=vim.VirtualMachine:238 ~/Desktop/ovfs/

5)
Download ovf file with progress tracking (Working)
#ovftool --machineOutput vi://root:[email protected]?moref=vim.VirtualMachine:238 ~/Desktop/ovfs/

6)
Convert an OVF to a VMX
#ovftool -tt=vmx a2.ovf ~/Desktop/
#ovftool vm1.ovf ~/Desktop/vm2.vmx

7)
Create a new VM "p1" on ESXI node 192.168.1.26 using *.vmx file
#ovftool -ds=datastore2 -n=p1 demovm2.vmx vi://root:[email protected]/
-ds --> Datastore
-n --> Name of new VM

8)
Create a new VM "k1" on ESXI node 192.168.1.126 using *.ovf file
#ovftool -ds=datastore2 -n=p2 demovm2.ovf vi://root:[email protected]/

9)
Convert a VMX to an OVF
#ovftool -tt=ovf a2.vmx ~/Desktop/
#ovftool -tt=ovf demovm2.vmx .

10)
Convert a VMX to an OVA
#ovftool -tt=ova a2.vmx ~/Desktop/
#ovftool -tt=ova demovm2.vmx .

11)
How to convert ova to ovf to vmx
a) 
ova to ovf
#ovftool -tt=ovf xvm1.ova .

b)
ova to vmx
#ovftool -tt=vmx xvm1.ova .

你可能感兴趣的:(cmd)