public void TestVMPowerOn() { VSphereHostConnection conn = new VSphereHostConnection(); VirtualMachine vm = new VirtualMachine("Auto", "WINXPPROHAMMERT", conn.GetVMConnectionFromPath("DataCenter/vm/HammerXP")); vm.Start(); }
public void TestRevertToSnapshot() { System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None); config.AppSettings.Settings.Clear(); config.AppSettings.Settings.Add("vixPath", @"C:\Program Files\VMware\VMware VIX"); config.AppSettings.Settings.Add("vSphereHost", @"vsphere-eng.quinton.com"); config.AppSettings.Settings.Add("vSphereUser", @"ENGDOM\pyramiswebbuilder"); config.AppSettings.Settings.Add("vSpherePass", @"Gilbert93"); config.AppSettings.Settings.Add("inbox", @"\\cmdstorage\Store2\VMAutomation\inbox"); config.AppSettings.Settings.Add("outbox", @"\\cmdstorage\Store2\VMAutomation\outbox"); config.AppSettings.Settings.Add("filedrop", @"\\cmdstorage\Store2\VMAutomation\drop"); config.Save(ConfigurationSaveMode.Modified); ConfigurationManager.RefreshSection("appSettings"); //WinXP_32, DataCenter/vm/Testing/VS-XP-PRO-SP3-IE6-x86, Auto, AutoXPProx86 VSphereHostConnection conn = new VSphereHostConnection(); VirtualMachine vm = new VirtualMachine("Auto", "AutoXPProx86", conn.GetVMConnectionFromPath("DataCenter/vm/Testing/VS-XP-PRO-SP3-IE6-x86")); vm.RevertToNamedSnapshot(); }