Deploy a VM from template with PowerCLI
Posted: February 17, 2012 Filed under: PowerShell / PowerCLI, VMware | Tags: deploy vm from template, deploy vm from template powercli, powercli, small vm, vm powercli Leave a commentNow that I have a small VM for my test lab, I converted it to a template and looked for a cool way to deploy several VMs from this template with PowerCLI. Turns out it’s actually really easy, anti-climactic, even. The good folks over at VMPros.nl have an excellent tutorial on this topic. Alan Renouf (Twitter @alanrenouf) was the first to comment on their blogpost. He included a nice for loop to replace a single line for each VM deployment. I incorporated Alan’s suggestion as well as a few options from the PowerCLI New-VM cmdlet reference page, like adding the VM to a resource pool and then powering on the VM.
Here’s the code: