Twitter: langonej
Published Work

TECHTARGET
- * Troubleshooting VMware View Bottlenecks with VMware AppSpeed
- * How to put the VMware View client on a USB drive with VMware ThinApp
- * Using VMware RAWC to see how VMware View workloads may affect your architecture
- * Reviewing bluelock vCloud Express
- * Reviewing the five official VMware vCloud Express providers
- * 10 virtualization predictions for 2010

VIRTUALIZATION.INFO
- * The Apple iPad Opened the Door for the Real Business Tablets
- * Designing the Virtual Data Center - Part 2: Building Blocks or Bespoke Bits?
- * Designing the Virtual Data Center - Part 1
OTHER SOURCES
Additional Info
User login
Use Powershell to Deploy Hundreds of VMs based on a Template (w/Customization)

I had an immediate need to deploy scores of virtual machines based off the same template and customization, which lead me to my first foray with Powershell. For those that follow this site, you'll know that PHP or Perl are much more comfortable for me, but alas, it's time to try what everyone is talking about.
I was pleasantly surprised by how little code was needed. I'm lazy and didn't do a for loop to numerically increment. Many thanks to this post on halfbyte.com and this post on NTPRO.NL, especially Eric Sloof's reminder to set the confirm flag.
#****************************************************
#Script to Deploy Multiple VMs from Template
#v1.0
#Written by: Jason Langone
#Many thanks to: Blog.Halfbyte.com and NTPRO.NL
#*****************************************************
Connect-VIServer -Server ntc-vcstg -Protocol https -User JensonButton -Password reardiffuser
Get-VMHost
$host1 = "esx3.test.local"
$template = "Win2K3"
$datastore = "NetAppFTW_1"
$customization = "Win2K3"
for($i = 1; $i -le 10; $i++)
{
$tempvm = "vServer-"+$i
$array += $tempvm
}
foreach ($vm in $array)
{
$vm=New-VM -Name $vm -Template $template -Host $host1 -Datastore $datastore -OSCustomizationSpec $customization -Confirm:$false
}
This will create 10 VMs named, "vServer-1," "vServer-2," ..., "vServer-10."
Many more Powershell scripts to come!
- Add new comment
- 2055 reads
Accolades






Video
"Green IT" - Leveraging VMware to provide a green datacenter.
Preview of the upcoming VMware View iPad App with PCoIP support.
Ubertechnik 350Z at VIR.
Latest from Disqus
Consulting Gigs
CURRENT GIGS for 1099 VCP's
- * VMware Site Recovery Manager Consultant.
Status: FILLED.
Duration: 3 WeeksLocation: Reston, VA
Clearance: None
- * Senior Solaris Consultant.
Duration: 3+ Weeks
Location: Reston, VA
Clearance: TS SCI
Note: All 1099 consultants must be a current VCP.

Ideal
Thank you for your detailed post.
online payday loan lenders
How about $vmhost1=
How about
$vmhost1= get-vmhost saesx07
$vmhost2= get-vmhost saesx08
$oscust=get-oscustomizationspec windows7II
$parent= get-template windows7view
$datastore =get-datastore xenapp
1..10 |foreach-object {New-VM -vmhost $vmhost2 -name "Stormtest$_" -template $parent -datastore $datastore -OSCustomizationSpec $oscust -confirm:$false}
With U1 you can use the new-vm to create one from a template and customize it.
Help!!! :o)
I am having problem with the script. The script return the following error when I try to run it. Your assistance will be highly appreciated, thank you in advance.
Value cannot be found for the mandatory parameter VMHost
At :line:23 char:10
+ $vm=New-VM <<<< -Name $vm -Template $template -Host $host1 -Datastore $datastore -OSCustomizationSpec $customization -Confirm:$false
THIS IS WHAT I DID......
Connect-VIServer -Server hart-u500.net.ccci.org -Protocol https -User Omar.Torres -Password ******
<<>Get-VMHost
$host1 = "hart-u600"
$template = "XP Desktop"
$datastore = "LUN02"
$customization = "CCDev"
for($i = 09; $i -le 12; $i++)
{
$tempvm = "Hart-CCDev-"+$i
$array += $tempvm
}
foreach ($vm in $array)
{
$vm=New-VM -Name $vm -Template $template -Host $host1 -Datastore $datastore -OSCustomizationSpec $customization -Confirm:$false
}