View Code on GitHub

Do you run VMware ESXi in your home lab? If the answer is yes, and you don't have your own automation method for deploying VM templates and are sick of creating new machines from scratch every time you want to spin up a new project, then this may be for you.

The OVF and PowerCLI tools are both handy on their own, but there's always room for improvement.

This post assumes that you've already created some VM templates and have them stored somewhere. Using this tool, you can do bulk deploys of your templates for whatever project you're working on. Need half a dozen VMs for a Kubernetes cluster? No problem. Here's how it works:

First, populate the configuration parameters in the script.

# Configuration Parameters
$VMServer = ""
$OVFRoot = ""
$OVFTool = ""

$VMServer is the IP address or hostname of your ESXi server, $OVFRoot is the location where you store your OVFs, and $OVFTool is the path to where you have the OVF Tool installed.

Your OVF root folder should look something like:

- Root directory
     - Ubuntu
          - files from OVF export
     - Centos
     - etc.

Upon executing the script you will be prompted for your username and password for your ESXi host.

01-creds

Next you'll choose from your list of VM Templates

02-deployments

Now we go through a few screens of selecting the spces for the VMs.
03-vcpus
04-ram
05-datastsore
06-network

Specify the number of VMs you want to create
07-vmcount

Give a name for your VMs
08-vmname

Confirm that it's what you want to do
09-confirm

Wait for the deployments to take place
10-deploy

Then bing bang boom, you've got your new machines and you didn't have to next, next, install your way through an OS install.

11-done

It's just that easy. Enjoy!