Question

Does anyone know how to get a hypervisor's domain settings from the PowerCLI? I want to get the name of the domain that the server is on, but looking through the vmware documentation (https://www.vmware.com/support/developer/vc-sdk/) I can't see how to retrieve it. I am targeting API version 4.1 and higher.

Any suggestions would be appreciated!

Was it helpful?

Solution

I was not able to get this working in the powerCLI, I think because I was not able to easily see what the underlying types of some objects were. However, I did find a way to get this through the VIM API, which should work the same way:

IHostAuthenticationManager hostAuthenticationManager = _hostSystem.Client.GetView(_hostSystem.ConfigManager.AuthenticationManager, null);
HostActiveDirectoryInfo activeDirectorySettings = hostAuthenticationManager.Info.AuthConfig.OfType<HostActiveDirectoryInfo>().FirstOrDefault();

activeDirectorySettings.JoinedDomain // The name of the domain the hypervisor is connected to
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top