itnifl123
Contributor
Contributor

How do I check for a licensed feature on a ESXi host? Getting: "The operation is not supported on the object."

This code is C#

public bool CheckLicenseFeature(string featureName, string hostName = "") {

  HostSystem host = null;

  if (String.IsNullOrEmpty(hostName)) {

  host = GetHostSystems().FirstOrDefault();

  } else {

  ost = GetHostSystems().Where(_host => _host.Name == hostName).FirstOrDefault();

  }

  if (host != null) {

  LicenseFeatureInfo lfInfo = GetLicenseManager().QuerySupportedFeatures(host.MoRef).Where(x => x.FeatureName == featureName).FirstOrDefault();

  if (lfInfo != null) {

  return true;

  }

  }

  return false;

}

When running QuerySupportedFeatures, I get:

The operation is not supported on the object.

Tags (1)
0 Kudos
0 Replies