PowerOn VM with powercli when host is disconnected and DRS is activated
I've a short question regarding powerCLI in case of DR test.
I try to automate the powerOn of some VMs based on priority to start applications in the right order.
During DR test, some ESXi servers are shut down with the VM on them. Then we want to restart them on the secondary site (Active/active storage underneath).
When I start the VM using VCenter interface, DRS will de-register then register the VM on a surviving host, I'm quite happy with that.
BUT, when I execute the Start-VM cmdlet on a VM that where running on a host that is now marked as disconnected (and the VM has also the disconnected flag) I've an error syaing that the host is not available and therefore the cmdlet cannot start the VM.
Do you know if there is another cmdlet available or another way to start VM only on connected hosts? and then let DRS do the job as using the VCenter interface. Or I've to automate the unregister / register stuff?