VMware Cloud Community
thedoctor46
Enthusiast
Enthusiast

AD Plugin: get configuration

Hi,

with AD Plugin 2.x i can use multiple domains. But now i need to focus one of these in my workflows. For example: i need to create a computer account in a specified domain (1 of 20).

My reasoning is to search for all configured domains about their properties, but i can't get this.

var configuration = new AD_ServerConfiguration();


configuration = ConfigurationManager.getConfigurationById("c4a40c51-dc14-4ae6-b699-c1d65b764acc");
var host = configuration.host;
System.out(host);

The Output is: TypeError: Cannot find default value for object.

Does anyone have an idea? How focused you your domain?

Reply
0 Kudos
2 Replies
sh0001
Contributor
Contributor

This is the best way I could find to get something working. Create an array of AD:AD_Hosts. Loop through each host configuration, searching for the domain you want. In the example below I am looking for the default domain field, if it matches my search variable adDomain then the script exits and you can use adDomainID as the adHost variable for the domain you want.

var adDomainSearch = AD_HostManager.findAllHosts();

for (var i = 0; i < adDomainSearch.length; i++) {

    var adDomainID = AD_HostManager.findHost(adDomainSearch[i].id);

    var adHostConfig = adDomainID.hostConfiguration

    var domainName = adHostConfig.defaultDomain

    if(domainName == adDomain){break}

}

Reply
0 Kudos
igaydajiev
VMware Employee
VMware Employee

Try changing line System.out(host) to System.log(host)



configuration = ConfigurationManager.getConfigurationById("f78c15c0-f6a6-4b9d-8e1f-46918eeac107");

var host = configuration.host;

System.log(host);

Reply
0 Kudos