My ramblings on the stuff that holds it all together
Quick and Dirty PowerShell to create a large number of test VMs with sequential names
Be gentle, I’m new to this PowerShell stuff – I have a requirement to create a large number of VMs from a template, this is the PowerShell Code I hacked together from a VMTN communities blog post – it’s not pretty but it works for me – you can play with the variables to adjust to your own environment and desired number of VMs.
In my case my template is a Linux VM setup ready to boot from a LiveCD – just so it generates some basic load when it starts up.
There is a bit of clever number formatting which I lifted from this blog post to pad the VM numbers out to 3 digits and make it tidy looking, not entirely sure I understand what it does – but it works!
I am using PowerGUI based on the info at Al’s blog here
Connect-VIServer -Server localhost >$null
$Date=get-date -uformat "%Y%m%d"
$NumArray = (1..$HOW_MANY_TO_CREATE)
foreach ($number in $numArray )
The Results (40 VM’s from template – completed in about 5mins);