HL Tools – Part 1 – Clone a VM without vCenter

In my homelab I try to automate as much as possible. I have a number of scripts and functions that help me setting up test environments in my homelab.  Since I got quite a number of requests on this, I decided to start a series on my homelab tools.

One of the tasks I automated is the provisioning of VMs. Quite easy when you have a vCenter that manages the cloning process. But in layer 1 of my homelab I’m running ESXi standalone on a PaaS provided server, so no vCenter.

With the Copy-DatastoreItem cmdlet it is easy to clone the files of a VM, but this kind of copy doesn’t know about the different types of VirtualDisk you can have in a VM. As a result, your Thin vdisks become Thick vDisks in the clone. The function in this post avoids that problem by using the VirtualDiskManager for copying the VMDK.


Note that there are a couple of prerequisites: the master VM needs to be powered off and have no snapshots. And till now I only tested this with VMs that run a Windows guest OS.

Continue reading HL Tools – Part 1 – Clone a VM without vCenter

dvSwitch scripting – Part 5 – Clone/pg to dvPG

An interesting question came up in the PowerCLI Community recently. Jason wanted to use a script from another thread where you could connect a NIC to a specific portgroup while cloning a new guest from a template.

The script didn’t work when the requested portgroup was on a dvSwitch. Enough of a reason for me to have another look.

Continue reading dvSwitch scripting – Part 5 – Clone/pg to dvPG