Tuesday, April 28, 2015

Rapid VM deployment of 100s of VMs at once

If you are a consulting company and want to deploy some 50, 100 or even what the heck 1000s of VMs on a customer's location and you don't want to be spending tons of man hours to do the same then use this script to do it for you.

#Rapid VM Deployer
#Author : Gajendra D Ambi
#Type : Powercli
#platform : VMware
$DeployTemplate = Get-Template Win2k12template #replace the Win2k12template with your template's name
$datastore = Get-Datastore Datastore01 #replace Datastore01 with the destination datastore on which the VMs should reside
#deploy vms from vmname-001 to 100
$VMNames = “VMname-{0:D3}”
$vms = @()
for ($i = 1; $i –le 100; $i++) {
$vm = $VMNames –f $i
$vms += New-VM -vmhost $host –Name $vm -Template $DeployTemplate -Datastore $datastore
of course you can have these VMs deployed with their respective static IPs, DNS, FQDN etc., pre configured using a csv file but more on that later. I only have time for this today