Skip to content

Instantly share code, notes, and snippets.

@chaderoth
Created November 12, 2017 18:24
Show Gist options
  • Save chaderoth/349e4d21753080cdeb6e32e6a1c03efc to your computer and use it in GitHub Desktop.
Save chaderoth/349e4d21753080cdeb6e32e6a1c03efc to your computer and use it in GitHub Desktop.
########################################################
# Create Hash Table #
# Create All VMs In $NewVMs #
# Populate Hash Table with Id of Each VM Creation Task #
########################################################
$TaskTable = @{}
foreach ($VM in $NewVMs){
$TaskTable[(New-VM -Name $VM -Template $VMTemplate -VMHost $ESXiHost -Location $VMLocation -Datastore $VMDatastore -RunAsync).Id] = $VM
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment