PowerShell OVF Helper

<-- Back to PowerShell OVF Helper

OVF Template for VMware ESXi Virtual Appliance

The following PowerShell snippet can be used to deploy VMware ESXi Virtual Appliance using PowerShell. The VMware.PowerCLI module is required to use the script.

  1. Copy the snippet to your favorite editor
  2. Change the path to your local OVA file
  3. Fill out the variables
  4. Connect to a vCenter Server using the Connect-VIServer command
  5. Run the script
ovf-VMware-ESXi-Virtual-Appliance.ps1:
$ovf = 'Z:\images\VMware\vSphere 7.0\Nested_ESXi7.0_Appliance_Template_v1.ova'
$ovfConfig = Get-OvfConfiguration $ovf
$ovfConfig.NetworkMapping.VM_Network.Value = ""        # Portgroup
$ovfConfig.common.guestinfo.hostname.Value = ""        # ESXi Hostname (Leave blank if DHCP)
$ovfConfig.common.guestinfo.ipaddress.Value = ""       # IP Address of vmk0 (Leave blank if DHCP)
$ovfConfig.common.guestinfo.netmask.Value = ""         # Netmask of vmk0 (Leave blank if DHCP)
$ovfConfig.common.guestinfo.gateway.Value = ""         # Gateway of vmk0 (Leave blank if DHCP)
$ovfConfig.common.guestinfo.vlan.Value = ""            # Optional: VLAN ID of vmk0
$ovfConfig.common.guestinfo.dns.Value = ""             # DNS Server (Leave blank if DHCP)
$ovfConfig.common.guestinfo.domain.Value = ""          # DNS Domain (Leave blank if DHCP)
$ovfConfig.common.guestinfo.ntp.Value = ""             # NTP Server
$ovfConfig.common.guestinfo.syslog.Value = ""          # Syslog Server
$ovfConfig.common.guestinfo.password.Value = ""        # ESXi Root Password (default VMware1!)
$ovfConfig.common.guestinfo.ssh.Value = $true          # Enable SSH ($true or $false)
$ovfConfig.common.guestinfo.createvmfs.Value = $false  # Create local VMFS Datastore ($true or $false)

$VMName = ""                  # Virtual Machine Display Name
$vmhost = ""                  # ESXi Host to deploy the VM
$datastore = ""               # Datastore to deploy the VM
$diskStorageFormat = "Thick"  # Thin or Thick provisionig of virtual disks

$vm = Import-VApp -Source $ovf -OvfConfiguration $ovfconfig -Name $VMName -VMHost (Get-VMHost -Name $VMHost) -Datastore $datastore -DiskStorageFormat $diskStorageFormat
#$vm | Start-VM   # Uncomment to power on the VM after creation.

Please leave a comment when you have issues with the deployment. Additional feature requests are also welcome.

Confirmed Images:
Nested_ESXi7.0_Appliance_Template_v1.ova
Nested_ESXi6.7u3_Appliance_Template_v1.ova
Nested_ESXi6.7u2_Appliance_Template_v1.ova
Nested_ESXi6.7u1_Appliance_Template_v1.ova
Nested_ESXi6.7_Appliance_Template_v1.ova
Nested_ESXi6.5u3_Appliance_Template_v1.ova
Nested_ESXi6.5u2_Appliance_Template_v1.ova
Nested_ESXi6.5u1_Appliance_Template_v1.0.ova
Nested_ESXi6.5d_Appliance_Template_v1.0.ova
Nested_ESXi6.0u3_Appliance_Template_v1.0.ova