The searchManagedEntity
function always returns null, I've tried many solutions on the web but unfortunately none of them worked.
Here's a snippet of my code:
ServiceInstance serviceInstance = authentification.connexionExsi();
Folder rootFolder = serviceInstance.getRootFolder();
System.out.println("Host" + (HostSystem) new InventoryNavigator(rootFolder).searchManagedEntity("HostSystem","192.168.1.44"));
Thank you in advance for your help <3
i've finally found the solution to this problem, you must use the name of ESXI host instead of the IP (ESXI Name = ESXI Hostname + Domain Name):
code:
ServiceInstance serviceInstance = authentification.connexionExsi();
Folder rootFolder = serviceInstance.getRootFolder();
System.out.println("Host"+new InventoryNavigator(rootFolder).searchManagedEntity("HostSystem","rabatos.Home").getName());
you can find the host & domain name in Dns & Routing, as depicted in the picture below: