Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 180259

Import-VApp Host did not have any virtual network defined

$
0
0

I have used the OVF tool to export a couple VM's from my 5.1 environment. When trying to import these VM's back into the environment using PowerCLi I get the error that is in the subject line. My hosts all currently use a VDS and one thing I read was add a virtual switch to the host that I am trying to import too. I have not tried that yet but I am curious why that would be required since it was not required on the export. I am using the 5.1 PowerCLi and my code is below.

 

 

********* Edit**********

Adding a regular vswitch to the host the script is now working. I have on physical adapter assigned to it, but it is not connected.

 

$items = Get-ChildItem -Path $OVF_Location -recurse | where {$_.psIsContainer -eq $false}
$format = ".ovf"
$VC_Password = ConvertTo-SecureString $VC_Password -AsPlainText -Force
$VCcred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Virtual_Center_Username, $VC_Password
Connect-VIServer -Server $Virtual_Center_Ip -Credential $VCcred
foreach ($item in $items)
{  $filename = $item.Name  if ($filename.Contains($format) -eq $true)  {        $vmhost = Get-Cluster | Get-VMHost | ?{$_.ConnectionState -eq "Connected"} | Get-Random  $myds = Get-datastore | Get-Random  if (($myds.FreeSpaceMB) -gt ($myds.CapacityMB * .25))    {  $datastore = $myds  }  else  {  Write-Host "There is not enough free space to create a Virtual Machine"  exit  }  $importPath = $item | select fullname  Write-Host "Importing OVF from: " $importPath.FullName " please wait as this will take some time."  $path = $importPath.FullName  Import-VApp -Source $path -VMHost $vmhost -Datastore $datastore  }
}
Disconnect-VIServer -Force -Confirm:$false

Viewing all articles
Browse latest Browse all 180259

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>