Function: vCenter Host System Configure DNS

by Simon Sparks · 2 February 2026

To use this function add it to the class library file named PluginVCHostSystemService.ts

GitHub Repository: https://github.com/SimonSparksUK/Orchestrator

Filename: PluginVCHostSystemService.ts

Function: ConfigureDns

public ConfigureDns(objVcHostSystem: VcHostSystem,  arrDnsAddress: string[], strDnsDomainName: string, arrDnsSearchDomain: string[]): void {

    let objVcHostDnsConfig: VcHostDnsConfig = new VcHostDnsConfig();
    objVcHostDnsConfig.address = arrDnsAddress;
    objVcHostDnsConfig.domainName = strDnsDomainName;
    objVcHostDnsConfig.searchDomain = arrDnsSearchDomain;

    let objVcHostNetworkConfig: VcHostNetworkConfig = new VcHostNetworkConfig();
    objVcHostNetworkConfig.dnsConfig = objVcHostDnsConfig;

    let objVcHostConfigManager: VcHostConfigManager = objVcHostSystem.configManager;

    let objVcHostNetworkSystem: VcHostNetworkSystem = objVcHostConfigManager.networkSystem;

    let objVcHostNetworkConfigCurrent: VcHostNetworkConfig = objVcHostNetworkSystem.networkConfig;

    if (objVcHostNetworkConfigCurrent.ipV6Enabled === true) {

        this.VcHostSystemMaintenanceModeEnter(objVcHostSystem);

        objVcHostNetworkSystem.updateNetworkConfig(objVcHostNetworkConfig, "modify");

        this.VcHostSystemMaintenanceModeExit(objVcHostSystem);
    }
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like