We are setting up multiple SQL Virtual Machines, spread over multiple nodes, so that they can auto migrate between nodes for load balancing, or for automatic failover during troubling times. These VMs use Hyper V.

Each time one of these VMs boot, a Scheduled Task is run to do some prerequisite checks before allowing the SQL Service to start. If the prerequisite checks fail, the database instance will not start.

Question is, is it possible for the same scheduled task to start when a VM is migrated? We need the same checks to take place when the VM arrives at a different node. Are scheduled tasks cluster aware? Is a migration treated the same as a newly booted server?

  • 1
    Using Live Migration, the VM won't even know it's been migrated, so I can't imagine why you'd need to run the checks again. – GregL Jan 30 '17 at 14:17

You can start a scheduled task when a event from windows event log appears.

In Hyper-V-worker\admin you have a log which describe the start or the restauration of a VM (see event log ID: 18596)

You can select "On event" in your scheduled task for launching the task and select the event log which corresponds with your need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.