/// <summary> /// Execute method /// </summary> /// <returns></returns> public override bool Execute() { try { var serverHostObject = HostsHelper.GetServerHostClass().CreateInstance(); if (serverHostObject != null) { serverHostObject["ServerName"] = ServerName; serverHostObject["HostName"] = HostName; serverHostObject.InvokeMethod("Map", null); } var hostInstanceObject = HostsHelper.GetHostInstanceClass().CreateInstance(); if (hostInstanceObject != null) { hostInstanceObject["Name"] = string.Format("Microsoft BizTalk Server {0} {1}", HostName, ServerName); } var args = new object[] { Username, Password }; if (hostInstanceObject != null) { hostInstanceObject.InvokeMethod("Install", args); } } catch (Exception ex) { Trace.WriteLine("CreateHostInstance - " + HostName + " - failed: " + ex.Message); throw; } return(true); }
/// <summary> /// Execute method /// </summary> /// <returns></returns> public override bool Execute() { try { HostsHelper.GetHostSettingsObject(HostName).Delete(); return(true); } catch (Exception ex) { Trace.WriteLine("Delete host failed: " + ex); throw; } }
/// <summary> /// Execute method /// </summary> /// <returns></returns> public override bool Execute() { try { var hostObject = HostsHelper.GetHostObject(HostName); hostObject.InvokeMethod(@"Stop", null, null); return(true); } catch (Exception ex) { Trace.WriteLine(@"Stop host failed: " + ex); throw; } }
/// <summary> /// Execute method /// </summary> /// <returns></returns> public override bool Execute() { var hostType = (HostType)Enum.Parse(typeof(HostType), HostType); try { var options = new PutOptions { Type = PutType.CreateOnly }; var btsHostSetting = HostsHelper.GetHostSettingClass().CreateInstance(); if (btsHostSetting != null) { btsHostSetting["Name"] = HostName; btsHostSetting["HostType"] = (int)hostType; btsHostSetting["NTGroupName"] = GroupName; btsHostSetting["AuthTrusted"] = Trusted; if (hostType == Tasks.HostType.InProcess) { btsHostSetting.SetPropertyValue("HostTracking", HostTracking); btsHostSetting.SetPropertyValue("IsDefault", IsDefault); } else { if (IsDefault || HostTracking) { Trace.WriteLine("Host Type is inprocess so Host Tracking and Is Default will be defaulted to false"); } } btsHostSetting.Put(options); } } catch (Exception ex) { Trace.WriteLine("CreateHost - " + HostName + " - failed: " + ex.Message); throw; } return(true); }