code: func (d Datacenter) PowerOnVM(ctx context.Context, vm []types.ManagedObjectReference, option ...types.BaseOptionValue) (*Task, error) {
  	if d.Client().IsVC() {
  		req := types.PowerOnMultiVM_Task{
  			This:   d.Reference(),
  			Vm:     vm,
  			Option: option,
  		}
  
  		res, err := methods.PowerOnMultiVM_Task(ctx, d.c, &req)
  		if err != nil {
  			return nil, err
  		}
  
  		return NewTask(d.c, res.Returnval), nil
  	}
  
  	for _, ref := range vm {
  		obj := NewVirtualMachine(d.Client(), ref)
  		task, err := obj.PowerOn(ctx)
  		if err != nil {
  			return nil, err
  		}
  
  		err = task.Wait(ctx)
  		if err != nil {
  			// Ignore any InvalidPowerState fault, as it indicates the VM is already powered on
  			if f, ok := err.(types.HasFault); ok {
  				if _, ok = f.Fault().(*types.InvalidPowerState); !ok {
  					return nil, err
  				}
  			}
  		}
  	}
  
  	return nil, nil
  }
docs: // PowerOnVM powers on multiple virtual machines with a single vCenter call.
  // If called against ESX, serially powers on the list of VMs and the returned *Task will always be nil.