VCF Automation Blog

from Stefan Schnell

In some cases it may be necessary or simply interesting to find out which version of the VMware Orchestrator is being used during the runtime of a JavaScript action.

Detect Orchestrator Version


Here an approach to detect the current Orchestator version.

/**
 *
 * @module de.stschnell
 *
 * @version 0.2.0
 *
 * @param {string} in_url
 *
 * @outputType string
 *
 */

function getOrchestratorVersion(in_url) {

// Begin ---------------------------------------------------------------

/**
 * Detects the VCF Automation Orchestrator version.
 *
 * The code is from Mischa Buijs
 * https://be-virtual.net/vrealize-orchestrator-identifying-version-running/
 *
 * @license MIT
 * @version 0.2.0
 *
 * Checked with VMware Aria Automation 8.12.0, 8.14.0, 8.16.2, 8.18.1
 * and VCF Automation 9.0.0
 */

/**
 * https://[yourFqdn]/vco/api/about delivers the following XML:
 *
 * <ns2:about-info>
 *   <ns2:build-number>22610007</ns2:build-number>
 *   <ns2:build-date>2023-10-14T16:17:05Z</ns2:build-date>
 *   <ns2:version>8.14.0.22610007</ns2:version>
 *   <ns2:api-version>8.x</ns2:api-version>
 *   <ns2:time-zone>
 *     <ID>GMT</ID>
 *     <rawOffset>0</rawOffset>
 *   </ns2:time-zone>
 *   <ns2:features/>
 *   <ns2:id>302e3139-3630-3532-3337-343132333136</ns2:id>
 * </ns2:about-info>
 */

fqdn = in_url.trim();
if (fqdn !== "") {

  url = "https://" + fqdn + "/vco/api/about";
  try {

    var urlObject = new URL(url);
    var result = urlObject.getContent();

    if (result) {

      var jsonObject = JSON.parse(result);
      var aboutVersion = jsonObject.version;
      var aboutBuildNumber = jsonObject["build-number"];
      var aboutBuildDate = jsonObject["build-date"];
      var aboutApiVersion = jsonObject["api-version"];

      System.log(fqdn);
      System.log("Version: " + aboutVersion);
      System.log("Build number: " + aboutBuildNumber);
      System.log("Build date: " + aboutBuildDate);
      System.log("API Version: " + aboutApiVersion);

      return aboutVersion;

    }

  } catch (exception) {
    throw "Error (" + exception.message + ")";
  }

}

// End -----------------------------------------------------------------

}

vcf automation orchestrator version detection