I had received a question the other day from a reader where they were trying to distinguish between the running VM and its placeholder VM due to their use of VMware Site Recovery Manager (SRM). Since the VM name is exactly the same in both vCenter Servers, it was not clear how to identify between the two. As mentioned in my reply to the reader, there are a couple of ways. You could use the SRM API in-conjunction with the vSphere API (in his case, he was using PowerCLI) to be able to check whether the VM in question was the placeholder VM or not.

Another option is to simply use the vSphere API and querying for the managedBy property which is populated when SRM and/or other solutions are associated with managing a set of VMs. In the case of SRM, you will see an extensionKey with value of "com.vmware.vcDR" and type with value of "placeholderVm" which tells you that the VM is an SRM Placeholder VM, pretty easy, right!? 🙂

Since I did not have an SRM environment handy, the next best thing was to check out VMware Hands-On-Lab environment which anyone can access for free. Lab HOL-1705-SDC-1 was exactly what I needed and here is a quick screenshot of the vSphere MOB showing you what the managedBy property looks like in the vSphere API.

To demonstrate the use of this vSphere API, I wrote a quick PowerCLI function called PlaceholderVMs.ps1 and below is an example of running the Get-PlaceholderVM command:

4 thoughts on “Quick Tip - Locating SRM Placeholder VMs using the vSphere API

  1. I love using the labs for things like these, saves me from having to spin up a whole test environment to try something like this… shhh don’t tell VMware!

  2. Another item to consider is that the extension key will be updated from “placeholderVm” to “testVm” when running a recovery plan test so if they want to differentiate between the protected VM and the placeholder and test VMs that is useful to know.

    I have a few examples of finding placeholder VMs, test VMs, and replicated VMs in my SRM cmdlets on GitHub here -> https://github.com/benmeadowcroft/SRM-Cmdlets/blob/f661cff5833b5a5598e6efb8922a4c77f75206e5/Meadowcroft.Srm.psm1#L123

Thanks for the comment!