Guys, just wanted to write up a quick post on how to spin up a linked clone in ESXi 6.0 using only PowerCLI, this may come in handy if you are testing in a lab environment or have the need to spin up multiple workstations quickly for endpoints for users without consuming a lot of storage. There are quite a few posts out there showing how to accomplish this process with PowerCLI. However, I wanted to in simple terms show how this can be done with a one liner. With PowerCLI the process is very simple and straightforward.
Create your Master
The first step you need to do is actually create your “master” VM which is normal VM creation with any other customizations that you want to do with the VM such as 3rd party apps, software, etc. Also, any processes such as sysprep that you want to do with the master is recommended. Thin provisioning is preferred. When you have everything ready to go with the master VM, you will want to power it off, create a snapshot which you need to name something meaningful – such as base image or master image, etc. The snapshot is disk the linked clones will be working from.
Let’s take a look at the PowerCLI commandlet with some variables in place to make it easier to see what goes where.
New-VM -Name $linkedclonename -VM $sourceVM -Location $vCenterFolder -Datastore $datastore -ResourcePool Resources -LinkedClone -ReferenceSnapshot $parentsnapshot
Hopefully the command above makes sense as written. Also, as you can easily see, we can replace the variables with the actual names of the pieces in our environment or you can use variables and set up the commandlet more for mass deployment.
This functionality is built into the latest version of PowerCLI available, PowerCLI 6 R3 and doesn’t require any add on fling, etc: https://my.vmware.com/web/vmware/details?downloadGroup=PCLI600R3&productId=491