VMware Cloud Community
ccowan8
Contributor
Contributor
Jump to solution

Not sure how to generate a list of SRMSite objects programmatically (without Inventory Browser)

Attempting to automate some SRM stuff, and I need SRMSite objects in order to grab the deploymentId, to be used later in other calls to get a list of unassigned replicated VMs .    I don't see any methods within SRM Plugin that will give me this info.  Any suggestions?

0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

I don't have SRM environment to verify it, but the following code should work:

var sites = Server.findAllForType("SRM:Site", "");

for each (var site in sites) {

    // do something with the site

}

View solution in original post

0 Kudos
4 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

I don't have SRM environment to verify it, but the following code should work:

var sites = Server.findAllForType("SRM:Site", "");

for each (var site in sites) {

    // do something with the site

}

0 Kudos
ccowan8
Contributor
Contributor
Jump to solution

Thanks.   Will try that now.  I've seen other references to this call.  What type of object is the Server?  (It is just the vCenter object).

Did find another technique.   SRM deploymentId is just the VRVcRemoteSite.vcInstanceUuid with a suffix concatenated to the end.

0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

Server is one of the predefined vRO helper/utility scripting classes. It is not related to vCenter, SRM or other 3rd-party systems.

You can find the list of methods provided by Server and other helper classes in the vRO documentation, available in vRO client UI > Tools > API Explorer...

0 Kudos
ccowan8
Contributor
Contributor
Jump to solution

Works like a champ for many things, including the SRMSite

0 Kudos