PowerCLI: HL Tools – Part 2 – Create a nested hypervisor

From VI-Toolkit
Jump to navigation Jump to search

Create a nested hypervisor

author: Luc Dekens

Description

From Luc's Home Lab series, the script to create a nested hypervisor VM. This will let you create a ESX or HyperV hypervisor VM for your lab so that you can experiment as much as you'd want without breaking anything important.

Usage

the following example (from his page) displays how-to create 3 nested ESX VM's and boot them after creation.

$esx = Get-VMHost -Name MyLab
$pgName = "Internal"
$pgObj = Get-VirtualPortGroup -Name $pgName
$pg = 1..4 | %{$pgObj}

$nestedParams = @{
  Name = $null
  VMHost = $esx
  DiskGB = 8
  NumCpu = 2
  MemoryGB = 8
  Portgroup = $pg
  CD = $true
  ISOPath = "[datastore1] ISO/VMware-VMvisor-Installer-5.1.0-799733.x86_64.iso"
  ESXi = $true
} 

1..3 | %{
  $nestedParams.Name = "ESX$($_)"
  $newesx = New-NestedHypervisor @nestedParams
  Start-VM -VM $newesx -Confirm:$false
}

Location

http://www.lucd.info/2013/07/12/hl-tools-part-2-create-a-nested-hypervisor/