VMware Cloud Community
NikhilPathak
Enthusiast
Enthusiast

OVF Tool cmdline to export OVF for specific VM

I am using below cmdlets to export the OVA/ OVF for a VAPP. Is it possible for getting it deeper and just export the specific VM.

#Enter the VCloud URL

$zone="vcloudlink"

#Enter Credentials for User login

$username = "id14928"

$password = "id14928"

#Enter org name

$vCD_ORG="ID14928-1-123456789"

#Enter orgVDC name

$vDC="ID14928-1-123456789"

#Enter VApp name

$vApp="1-123456789"

#EnterVM name

$vm = "NeutralNode"

# Build the vCloud Connection String

$vCloud="vcloud://${username}:${password}@${zone}:443?org=${vCD_ORG}&vdc=${vDC}&vapp=${vApp}"

write-host "vCloud Connection String" $vCloud

write-host""

# Set the OVFTool EXE and execute it with some arguments

$app = 'C:\Program Files\VMware\VMware OVF Tool\ovftool.exe'

$arg1 = "$vCloud"

$arg2 = 'F:\test'+"\$($vApp).ova"

& $app $arg1 $arg2

Reply
0 Kudos
2 Replies
Alex_Romeo
Leadership
Leadership

Hi,

http://jdgreen.io/export-vms-via-command-line-using-ovf-tool/

Alessandro Romeo

Blog: https://www.aleadmin.it/
Reply
0 Kudos
AdmLAS
Contributor
Contributor

Hello

I'm modifing this script for my VMWare 6.5 infrastructure.

But When i tape this command :

$vCloud="vcloud://${username}:${password}@${zone}:443?org=${vCD_ORG}&vdc=${vDC}&vapp=${vApp}", in PowerCli i have the error :

"Unexpected token '&' in expression or statement. The ampersand (&) character is not allowed...."

Do you have an idea for the reason i have this error ?

Thx for reply.

Reply
0 Kudos