Does anyone know how to import an OVA file via PowerCLI?
I have tried the command
> Import-VApp -Source "C:\winxp.ova" -VMHost 10.253.253.132 -Datastore datastore1
And get the fallowing error
C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI
Import-VApp -Source "C:\winxp.ova" -VMHost 10.253.253.132 -Datastore datastore1
Import-VApp : 6/4/2010 2:08:57 PM Import-VApp Unable to get object by
name: not connected.
At line:1 char:12
+ Import-VApp <<<< -Source "C:\winxp.ova" -VM
Host 10.253.253.132 -Datastore datastore1
+ CategoryInfo : InvalidResult: (System.Collecti...s.VIAutomation
]:List`1) , ObnTerminatingException
+ FullyQualifiedErrorId : Core_ObnSelector_GetClientListForObnParameter_No
DefaultServer,VMware.VimAutomation.VimAutomation.Commands.ImportVApp
Import-VApp : 6/4/2010 2:08:57 PM Import-VApp VMHost parameter: Canno
t find any of the objects specified by name.
At line:1 char:12
+ Import-VApp <<<< -Source "c:\winxp.ova" -VM
Host 10.253.253.132 -Datastore datastore1
+ CategoryInfo : ObjectNotFound: (VMware.VimAutomation.Types.VMHo
st VMHost:RuntimePropertyInfo) , ObnRecordProcessingFailedExc
eption
+ FullyQualifiedErrorId : Core_ObnSelector_SetNewParameterValue_ObjectNotF
oundCritical,VMware.VimAutomation.VimAutomation.Commands.ImportVApp
Hello,
Import-VApp supports only OVF format. The problem that you hit is that the cmdlet does not validate the input files by extension and tries to load OVA although it cannot import it.
We've already know about this issue and in the next PowerCLI release this validation is done and the cmdlet says that it can import only OVF.
Vitali
The problem is that the Import-VApp parameters requires VMware objects instead of strings. You should do something like:
Connect-VIserver -Server <YourVIServer> -Credential (Get-Credential) $VMhost = Get-VMHost -Name <YourVMHostname> $Datastore = Get-Datastore -Name <YourDatastoreName> -VMHost $VMHost Import-VApp -Source "C:\winxp.ova" -VMHost $VMHost -Datastore $Datastore
Regards, Robert
This is what i came up with -
Connect-VIserver -Server 10.253.253.132 -Credential (Get-Credential)
$VMhost = Get-VMHost -Name 10.253.253.132
$Datastore = Get-Datastore -Name datastore1 -VMHost $VMHost
Import-VApp -Source "c:\PE-winxp.ova" -VMHost $VMHost -Datastore $Datastore
This is the error i recived after running the above
Import-VApp : 6/4/2010 3:15:38 PM Import-VApp 52531b20-e3f3-c44d-87a8-847
ca2b8eb9a Exception of type 'System.OutOfMemoryException' was thrown.
At line:1 char:12
+ Import-VApp <<<< -Source "c:\PE-winxp.ova" -VMHost $VMHost -Datastore $Datas
tore
+ CategoryInfo : NotSpecified: ( , ViError
+ FullyQualifiedErrorId : Client20_VappServiceImpl_ExportVApp_Error,VMware
.VimAutomation.VimAutomation.Commands.ImportVApp
It seems that the PC on which you run this script has not enough memory to perfom the import. Maybe you can try the script on another PC or server with more memory?
i thought the same thing, but the box that i tired it on has 12gb of memory.
If 12 Gb is not enough then I don't know how much memory you will need. The System.OutOfMemoryException is definitely a Windows error message issued by .NET. See: OutOfMemoryException Class.
Hello,
Import-VApp supports only OVF format. The problem that you hit is that the cmdlet does not validate the input files by extension and tries to load OVA although it cannot import it.
We've already know about this issue and in the next PowerCLI release this validation is done and the cmdlet says that it can import only OVF.
Vitali
Do you know of any way to script the import of an OVA file?
Hi again,
The OVA is a tar file that contains OVF, MF and all VMDK files. So you can use any un-tar utility and after that to use Import-vApp commandlet passing the OVF to -Source parameter.
For more information about OVF/OVA refer to http://www.vmware.com/appliances/getting-started/learn/ovf.html, see Open Virtualization Format Specification
At point 5.3 Distribution as a Single File it is written that:
"An OVF package may be stored as a single file using the TAR format. The extension of that file shall be .ova (open virtual appliance or application)."
Vitali
the best way i found to do this is through the OVF tools and use the basic command (see below)
ovftool <options> <source locator> <target locator>