Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 207710

OVFTool from within PowerCLI

$
0
0

Hi Guys.

 

I have a number of vApps that I need to import into vCenter (4.1).

 

I need to use OVFTool (as i'm working with .ova files - and therefore can't use Import-vApp).

 

At the moment I have a script that imports a .csv that looks something like:

 

Name,Datastore,Network,Diskmode,Source

"vApp1","Datastore1","Network1","thin,","C:\vApps\vApp1.ova"

"vApp2","Datastore2","Network2","thick","C:\vApps\vApp2.ova"

 

etc.

 

And a script that looks something like:

 

$csv = Import-Csv -Path "C:\VMs.csv"

 

$csv | Foreach-Object {

"C:\Program Files\VMware\Vmware OVF Tool\ovftool.exe" --datastore=$_,Datastore --Network=$_.Network --Diskmode=$_.Diskmode $_.Source vi://$VcUser:VcPass@VcIp/Datacenter/host/Cluster/

}

 

But the script barfs at the '--datastore' option.  I'm not sure if it's:

 

a) A scripting syntax issue (e.g i need to use speechmarks or brackets differently)

b) OvfTool doesn't like variable substitution

c) I need to use Invoke-Command or Start-Job .

 

If i cant do this in powercli, is there any other way of running OVFTool in 'bulk' against a .csv?

 

Any help would be much appreciated.


Dan


Viewing all articles
Browse latest Browse all 207710

Trending Articles