I have to standby ESXi and i use this program
package package1;
import java.net.URL;
import com.vmware.vim25.mo.Task;
import com.vmware.vim25.mo.HostSystem;
import com.vmware.vim25.mo.ManagedEntity;
import com.vmware.vim25.mo.ServiceInstance;
import com.vmware.vim25.mo.InventoryNavigator;
public class Standby {
public static void main(String[] args) throws Exception {
{
HostSystem hs;
ServiceInstance si = new ServiceInstance(new URL(args[0]), args[1], args[2], true);
ManagedEntity[] hostmanagedEntities = new InventoryNavigator(
si.getRootFolder()).searchManagedEntities("HostSystem");
hs = (HostSystem) hostmanagedEntities[2];
Task standby = hs.powerDownHostToStandBy(30, true);
standby.waitForTask();
}}}
But instead of using number of array Like [1] for some Esxi server and [2] for another server , can i put IP of this ESXi server directly and standby this server