VMware Cloud Community
KiwiDave
Enthusiast
Enthusiast

How to detect if VM is managed by SRM?

Is there a simple way in Orchestrator to determine if the VM is managed by Site Recovery Manager?

More specifically, I am talking about the VM on the secondary site which is sitting in a powered-off state.. I would like to exclude these from reports/actions made across all VMs in a vCenter instance.

Thanks in advance,

Dave

5 Replies
mbrkic
Hot Shot
Hot Shot

Yes.

There is a property VM.config.managedBy that is set if the VM is registered as being managed by some other solution (in your case SRM, but it also works for vCloud Director for example).

You can do something like this (assuming that thisvm is your vm object):

if(thisvm.config.managedBy != null) {

  if(thisvm.config.managedBy.type == "placeholderVm") {

// do something here for the SRM VMs

  }

  else {

// do something here for non-SRM VMs

}

Hope this helps.

Cheers,

Milos

jonathanvh
Enthusiast
Enthusiast

this should also do it:

if (vm.config.managedBy == null) //not the placeholder VM

mbrkic
Hot Shot
Hot Shot

The problem with just checking for managedBy being null is that this can be set by other solutions, such as vCloud Director for example, and you will end up counting those other VMs as SRM VMs as well. In order to select only the SRM VMs you must make sure that the mangedBy.type is set to "placeholderVm". Hopefully no other solution uses this same type setting.

Cheers,

Milos

0 Kudos
SachinRanade
Contributor
Contributor

Look up on VSRM database to check if the VM is replicated

0 Kudos
bccigna
Enthusiast
Enthusiast

Should this action work with a 5.5 database? I'm receiving an invalid object name error for 'RetentionPolicyTierEntity'.

0 Kudos