WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud
  • Tanzu
    • Application Modernization
    • Tanzu services
    • Tanzu Community Edition
    • Tanzu Kubernetes Grid
    • vSphere with Tanzu
  • Home Lab
  • Nested Virtualization
  • Apple
You are here: Home / Automation / Quick Tip - Locating SRM Placeholder VMs using the vSphere API

Quick Tip - Locating SRM Placeholder VMs using the vSphere API

07.26.2017 by William Lam // 5 Comments

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:

More from my site

  • Automating VMware Site Recovery (DRaaS) with VMC
  • Automating Customer Experience Improvement Program (CEIP) configuration using vSphere API and PowerCLI
  • Instant Clone Microsoft Windows & VM Keystroke VMworld demo and code posted
  • Retrieving detailed per-VM space utilization on VSAN
  • Quick Tip - How do I tell if NSX-V or NSX-T is installed?

Categories // Automation, PowerCLI, SRM Tags // placeholder VM, PowerCLI, site recovery manager, srm, vSphere API

Comments

  1. Hywel Burris says

    07/26/2017 at 9:48 am

    That's interesting is there anyway to get this information into vROp's.

    Reply
  2. Jason says

    07/26/2017 at 11:07 am

    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!

    Reply
  3. Ben Meadowcroft (@BenMeadowcroft) says

    07/26/2017 at 12:55 pm

    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

    Reply
    • Ben Meadowcroft (@BenMeadowcroft) says

      07/26/2017 at 12:57 pm

      To be clear it is the type value associated with the extension key, not the extension key name itself that is updated during testing.

      Reply
  4. Nick Maludy says

    05/08/2020 at 8:30 am

    This is the only way i was able to determine if a VM is a placeholder in an SRM config. Using the SRM API i was not able to get the MOIDs for the VMs on both sides of the replication, SRM API only returns the MOID of the "active" VM. I'm sure SRM has this mapping information internally somewhere, but unfortunately i couldn't find it exposed in the API.

    Thank you for this!

    Reply

Thanks for the comment! Cancel reply

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

Search

Author

William Lam is a Senior Staff Solution Architect working in the VMware Cloud team within the Cloud Infrastructure Business Group (CIBG) at VMware. He focuses on Cloud Native technologies, Automation, Integration and Operation for the VMware Cloud based Software Defined Datacenters (SDDC)

Connect

  • Email
  • GitHub
  • LinkedIn
  • RSS
  • Twitter
  • Vimeo

Recent

  • Changing the default HTTP(s) Reverse Proxy Ports on ESXi 8.0 03/22/2023
  • Quick Tip - How to download ESXi ISO image for all releases including patch updates? 03/15/2023
  • SSD with multiple NVMe namespaces for VMware Homelab 03/14/2023
  • Is my vSphere Cluster managed by vSphere Lifecycle Manager (vLCM) as a Desired Image or Baseline? 03/10/2023
  • Interesting VMware Homelab Kits for 2023 03/08/2023

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 © 2023

 

Loading Comments...