WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / Automation / Which VM was this vSphere VM cloned from?

Which VM was this vSphere VM cloned from?

01.11.2021 by William Lam // 4 Comments

This was a question that I saw back in December on the VMware {code} Slack which was quickly answered by the always awesome Luc Dekens. The solution is to look at vCenter Server Events, which are super rich in information and can be used for a number of things including identifying the source VM that it was cloned from. When I was a customer, this was something I did all the time, using events for auditing purposes but also identifying who, what and when a certain operation was performed including source VMs for cloning operations.

Although this information maybe known to some, there is still not an elegant solution that can help someone quickly identify the source VM for a specific vSphere VM that was cloned. This topic also intrigued me as I have seen this question come up in the past. I figure I might as well add this to my random scripting backlog and take a look when I had some time.

Before taking a look at the solution, it is important to understand the different types of clones that exists in vSphere today and also the respective vCenter Server events that can help us correlate to both the source VM but also the specific clone type.

Cloning Types

  • Full Clone - An independent copy of a virtual machine that shares nothing with the parent virtual machine after the cloning operation. Ongoing operation of a full clone is entirely separate from the parent virtual machine
  • Linked Clone - A copy of a virtual machine that shares virtual disks with the parent virtual machine in an ongoing manner. This conserves disk space, and allows multiple virtual machines to use the same software installation
  • Instant Clone - An independent copy of a virtual machine that starts executing from the exact running state of the source powered on virtual machine. Instant Clone uses rapid in-memory cloning of a running parent virtual machine and copy-on-write, simliar to that of Linked Cloning to rapidly deploy virtual machines

vCenter Event Types

  • VmClonedEvent - Triggered when a Full Clone or Linked Clone has been performed
  • com.vmware.vc.VmInstantClonedEvent - Triggered when an Instant Clone has been performed
  • VmDeployedEvent - Triggered a VM has been deployed either from a vSphere Template or Content Library Template

Using this information, I have created a PowerCLI function called Get-VMCloneInfo which can be installed directly from the PowerShell Gallery by running:

Install-Script VMCloneInfo

The function accepts a single parameter called -VMName which is the name of the VM that you wish to look up the cloning information about. Below are some example output for the various cloning scenarios which will output the clone type, source VM, Date and User that performed the original clone operation.

Cloning Scenarios

#1 - Here is a example when specifying a VM that was not cloned:

> Get-VMCloneInfo -VMName "SourceVM"
Unable to find any cloning information for SourceVM, VM may not have been cloned or vCenter Events have rolled over

#2 - Here is an example when specifying a VM that was Full Cloned:

> Get-VMCloneInfo -VMName "Full-Clone-VM"
Type Source Date User
---- ------ ---- ----
Full SourceVM 1/3/2021 1:13:00 PM VSPHERE.LOCAL\Administrator

#3 - Here is an example when specifying a VM that was Linked Cloned:

> Get-VMCloneInfo -VMName "Linked-Clone-VM"
Type Source Date User
---- ------ ---- ----
Linked SourceVM 1/3/2021 1:13:14 PM VSPHERE.LOCAL\Administrator

#4 - Here is an example when specifying a VM that was Instant Cloned:

> Get-VMCloneInfo -VMName "Instant-Clone-VM"
Type Source Date User
---- ------ ---- ----
Instant SourceVM2 1/3/2021 1:12:44 PM VSPHERE.LOCAL\Administrator

#5 - Here is an example when specifying a VM that was cloned from a vSphere Template:

> Get-VMCloneInfo -VMName "VMTX-VM"
Type Source Date User
---- ------ ---- ----
Full SourceVMTXTemplate 1/3/2021 2:20:31 PM VSPHERE.LOCAL\Administrator

#6 - Here is an example when specifying a VM that was cloned from a Content Library VM Template:

> Get-VMCloneInfo -VMName "VMTemplate-VM"
Type Source Date User
---- ------ ---- ----
Full SourceVMTemplate 1/3/2021 2:23:41 PM VSPHERE.LOCAL\Administrator

More from my site

  • Instant Clone Apple MacOS
  • Instant Clone Microsoft Windows & VM Keystroke VMworld demo and code posted
  • How Wrecking Crew Inc. leveraged vSphere's Instant Clone to instantly provision hundreds of VMs
  • Instant Clone community customization script repository
  • How to VMFork aka Instant Clone Nested ESXi?

Categories // Automation, PowerCLI, vSphere Tags // clone, instant clone, linked clones, PowerCLI

Comments

  1. *protectedthekhord says

    02/01/2022 at 3:14 pm

    Can it be adjusted to take a VM MOID or a whole VM object, and provide the source VM's MOID in the output? We run hundreds of sets of the same named VMs so providing a name isn't really feasible for such large scale cases.

    Reply
    • *protectedACME214 says

      02/03/2022 at 9:47 am

      This is a great help provided you already know the name of the vm. We have several guests in the environment that were originally created as clones but we have no idea which ones.
      How can we tweak this to output a list of all guest vms in the vcenter that were created as clones?

      Reply
  2. *protectedSteve Rock says

    03/13/2025 at 10:56 am

    Pretty much useless unless your VM was created recently, as event retention is set by default to only 30 days.

    Reply
    • William Lam says

      03/13/2025 at 2:01 pm

      Not necessarily. Many customers run job to pull this info and/or update VMs w/vSphere Tag or Annotation. Some go further and built more Event Driven Automation, so that info is externalize from VC

      But yes, if the data isn’t there, you don’t have it. Nothing around that but can be applied to many other aspects 🙂

      Reply

Thanks for the comment!Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025