Hi LucD,
Thanks for the quick reprocesses. I would just store the data in the script itself. No need for an external file. Also the reason we use PowerCLI 6.0 is due to testing of software. Our company has a strick testing policy and usually do not run the latest and greatest of everything.
The rules would be defined as follows and in order as numbered:
At the top of the script would be the prefered VM and Host information. (But not necessarly the case, the VM's do not have a prefered host just that they are seperated) So say Host A for VMA and Host B for VMB. In adittion to power up order meaing if both VM's are down which one to power on first. Should be a 2 min delay between turning on one verses the other.
Rules are as follow:
1. If either Host A or Host B is off it would tell the user Host A/B is no longer available to process VM ... ect. Then would check to see if the secondary host (The one powered on) has both VM's running (Powerd On) if one or both are powered off ask the user if it would like to power it them on (following the power up priority). End script
2. Then the scriped would Check to see if Host A has VMA and Host B has VMB and they are both powerd on. (If this is correct the script would tell the user that the VM's are segragated properlly and no further action required) If they are segregated but not powered on it would ask if you would like to power on the machines either one or both if they are down (again following power up priority).
3. If one host has both VM's and both hosts are working it would do one of 3 options:
a. If both vm's are down it would migrate one to its correct host and then use the power up priority to turn them both on.
b. If one VM is on then it would migrate the powerd off VM and turn it off (regardless of the host vm preferance).
c. If both vm's are on it would ask if you like to move one of the powered on vm's to its correct preferance host.
Then that would cover the majority of cases. Cannot think of a case out side of this.
Another "Nice to have". I have several pairs of VM's / redundant Host pairs. If we could program in the top a list of say all the host and vm's say HOST A / B / C / D vm A / B / C / D where a user could select say SITE 1, 2 ... ect. and the script would run on a different VM host pair. Like Site one would be HOST A/B and VM A/B and Site 2 would be HOST C/D and vm C/D.
Thanks again for all the help. Any base code should get me moving in the correct direction anyway.