VMware Cloud Community
VipalGujrathi
Contributor
Contributor

Powercli / ovftool to deploy OVA

All,

I need to know how can we include ovftool in script to deploy OVA from local datastore? I have one project to deploy OVA on 1200 ESXi cluster. I do have core powercli script to deploy OVA, but it doesn't support https protocol, ovftool does. Powercli script working without any issue but deploying ova over network takes time.

I am planning to copy ova to local datastore with powercli and use ovftool to deploy OVA on cluster.

Reply
0 Kudos
11 Replies
LucD
Leadership
Leadership

There is this handy function Invoke-OvfTool


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

VipalGujrathi
Contributor
Contributor

Thanks Lucd,

I used below method, please let me know what do you think

$ovftool = "$PATH\ovftool.exe"

$Source =  "Path to OVA"   ##  Https link if stored on ESX datastore

$target  = "vi://username:password@vcip/datacenter/host/cluster

Start-Process $ovftool -Argumentlist  FirstArg, second argu,  $Source, $target -nonewwindow

All Arguments are ovftool command syntax, e.g.  --acceptAllEulas,  --datastore="datastorename" etc.

This deploy OVA without any issue, just need to be added in script

Reply
0 Kudos
LucD
Leadership
Leadership

The function I pointed to earlier, uses the same concept with Start-Process.

The only difference is that the function uses a JSON file to pass all the parameters.

If it works for you, it's a good solution :smileygrin:


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
VipalGujrathi
Contributor
Contributor

I am getting below error while importing OVA to vSphere 6.7  (used OVFtool 4.3)

Error:

- Line 172: Duplicate element 'InstanceID'.

- Line 208: Duplicate element 'InstanceID'.

Completed with errors

I changed OVA, tried to import to other vcenter with same version but no joy.  It work if I use it on vSphere 6.5

Any idea? what is wrong here?

Reply
0 Kudos
LucD
Leadership
Leadership

Which script is that?

Perhaps you can attach it as a file?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
VipalGujrathi
Contributor
Contributor

Hi Lucd,

Here is my script,  I used manual method also

ovftool.exe  arg1 arg1  source locator  target

it works on 6.5 without any issue.

Reply
0 Kudos
LucD
Leadership
Leadership

I don't find a line 172 or 208 in there


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
VipalGujrathi
Contributor
Contributor

Hi Lucd,

its not script related error.

If we use --machinOutput (ovftool syntax)    I get below detailed error which I mentioned. Initially I thought its OVA issue, I changed OVA also.

MANIFEST
+ <ManifestValidate valid="true"/>

ERROR
+ <Errors>
+ <Error>
+ <Type>
+ vim.fault.OvfDuplicateElement
+ </Type>
+ <LocalizedMsg>
+ Line 172: Duplicate element &apos;InstanceID&apos;.
+ </LocalizedMsg>
+ <Arg type="int" fieldName="lineNumber">
+ 172
+ </Arg>
+ <Arg type="string" fieldName="name">
+ InstanceID
+ </Arg>
+ </Error>
+ <Error>
+ <Type>
+ vim.fault.OvfDuplicateElement
+ </Type>
+ <LocalizedMsg>
+ Line 208: Duplicate element &apos;InstanceID&apos;.
+ </LocalizedMsg>
+ <Arg type="int" fieldName="lineNumber">
+ 208
+ </Arg>
+ <Arg type="string" fieldName="name">
+ InstanceID
+ </Arg>
+ </Error>
+ </Errors>

RESULT
+ ERROR

Reply
0 Kudos
LucD
Leadership
Leadership

Ok, you could try the same with another OVA if possible.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
VipalGujrathi
Contributor
Contributor

Hi Lucd,

I used other OVA (vSphere appliance 6.7) and it is working.

I was trying to deploy  EMC RecoveryPoint OVA earlier.

I am still not able to understand one OVA deployment Is successful and one is not working.

Reply
0 Kudos
LucD
Leadership
Leadership

Seems to indicate that there might be an issue with that OVA with that version of ovftools and that version of vSphere.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos