by Stan Czerno
21. July 2011 18:15
I schedule this script to run at Startup of the Hyper-V Host to check to see if VMs have been Live Migrated to another Host.
If the VM has this Host set as being the Preferred Owner, Live Migrate them back to this Node.
I set the scheduled task as:
Security: Run whether the user is logged on or not, Run with highest privileges.
Trigger: "At startup" and delay it for 5 minutes.
Action: "Start a program", Program/Script: powershell -command "& 'C:\scripts\movebacktopreferred.ps1'"
This script is only designed to work with a Two-Node Cluster but it is a good starting point if you have more than a Two Node Cluster. Another foreach will need to be used for the multiple nodes in the Cluster.
http://www.czerno.com/default.asp?inc=/html/windows/hyperv/cluster/HyperV_Live_Migrate_VMs_back_to_Preferred_Owner.asp
Let me know what you think about the script and if you have a better way of doing this.
114151ef-5aec-488d-8b10-bd867304c523|0|.0
Tags:
Hyper-V