public void ProjectInstaller_BeforeInstall(object sender, System.Configuration.Install.InstallEventArgs e) { List <ServiceController> services = new List <ServiceController>(ServiceController.GetServices()); foreach (ServiceController s in services) { if (s.ServiceName == this.serviceInstaller1.ServiceName) { if (s.Status != ServiceControllerStatus.Stopped) { s.Stop(); while (s.Status != ServiceControllerStatus.Stopped) { Thread.Sleep(1000); s.Refresh(); } } ServiceInstaller ServiceInstallerObj = new ServiceInstaller(); ServiceInstallerObj.Context = new System.Configuration.Install.InstallContext(); ServiceInstallerObj.Context = Context; ServiceInstallerObj.ServiceName = "MSB_Sentry_Monitor"; ServiceInstallerObj.Uninstall(null); break; } } }
private void ProjectInstaller_AfterInstall(object sender, System.Configuration.Install.InstallEventArgs e) { using (ServiceController sc = new ServiceController(MyServiceInstaller.ServiceName)) { sc.Start(); } }
void ShortBusServiceInstaller_BeforeInstall(object sender, System.Configuration.Install.InstallEventArgs e) { System.Console.WriteLine("*************************************************************"); System.Configuration.Install.Installer x = (sender as System.Configuration.Install.Installer); string sname = "ShortBusSubscriber"; string sdesc = "Short Bus Subscriber"; string dname = "Short Bus Subscriber"; if (!string.IsNullOrEmpty(Program.serviceName)) { sname = Program.serviceName; } if (!string.IsNullOrEmpty(Program.serviceDesc)) { sdesc = Program.serviceDesc; } if (!string.IsNullOrEmpty(Program.displayName)) { dname = Program.displayName; } List <KeyValuePair <string, string> > paramsAsList = new List <KeyValuePair <string, string> >(); Console.WriteLine("f**k"); foreach (string k in x.Context.Parameters.Keys) { paramsAsList.Add(new KeyValuePair <string, string>(k, x.Context.Parameters[k])); } string keyValue = null; keyValue = paramsAsList.FirstOrDefault(g => g.Key.Equals("servicename", System.StringComparison.OrdinalIgnoreCase)).Value; if (!string.IsNullOrEmpty(keyValue)) { sname = keyValue; } keyValue = paramsAsList.FirstOrDefault(g => g.Key.Equals("servicedescription", System.StringComparison.OrdinalIgnoreCase)).Value; if (!string.IsNullOrEmpty(keyValue)) { sdesc = keyValue; } keyValue = paramsAsList.FirstOrDefault(g => g.Key.Equals("displayname", System.StringComparison.OrdinalIgnoreCase)).Value; if (!string.IsNullOrEmpty(keyValue)) { dname = keyValue; } this.ServiceInstaller1.ServiceName = sname; this.ServiceInstaller1.Description = sdesc; this.ServiceInstaller1.DisplayName = dname; Console.WriteLine("Service Name: {0}", sname); Console.WriteLine("Service Description: {0}", sdesc); Console.WriteLine("Display Name: {0}", dname); }
void ProjectInstaller_BeforeInstall(object sender, System.Configuration.Install.InstallEventArgs e) { List <ServiceController> services = new List <ServiceController>(ServiceController.GetServices()); foreach (ServiceController s in services) { if (s.ServiceName == "MSB_Virus_Sentry") { ServiceInstaller ServiceInstallerObj = new ServiceInstaller(); ServiceInstallerObj.Context = new System.Configuration.Install.InstallContext(); ServiceInstallerObj.Context = Context; ServiceInstallerObj.ServiceName = "MSB_Virus_Sentry"; ServiceInstallerObj.Uninstall(null); break; } if (s.ServiceName == "MSB_Sentry_Monitor") { ServiceInstaller ServiceInstallerObj = new ServiceInstaller(); ServiceInstallerObj.Context = new System.Configuration.Install.InstallContext(); ServiceInstallerObj.Context = Context; ServiceInstallerObj.ServiceName = "MSB_Sentry_Monitor"; ServiceInstallerObj.Uninstall(null); break; } } }
void ServiceInstaller_AfterInstall(object sender, System.Configuration.Install.InstallEventArgs e) { using (System.ServiceProcess.ServiceController sc = new System.ServiceProcess.ServiceController(serviceInstaller.ServiceName)) { sc.Start(); } }
private void serviceInstaller1_AfterInstall(object sender, System.Configuration.Install.InstallEventArgs e) { // Start the service. ServiceController DaemonService = new ServiceController(DAEMON_NAME); DaemonService.Start(); }
private void serviceInstaller_AfterInstall(object sender, System.Configuration.Install.InstallEventArgs e) { /* ISSUE 33: Somehow we need to copy the default config for Swiffotron into the * installation folder. It's an embedded resource though, and I have no * idea how this crazy setup stuff is meant to find it. It does get copied * into the project output though, along with the XSD files. You'd think * that'd be enough. * Maybe we can hack the primary output list in the setup project file, or something. */ }
/// <summary> /// Try to parse the arg from InstallUtils arguments and apply them to the service assemblypath /// /// To Install: /// C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe /listen=5555 /token=YourS3cur!tyTok3n /i DD.exe /// /// To Uninstall: /// C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe /listen=5555 /token=YourS3cur!tyTok3n /u DD.exe /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ChangeAssemblyPath(object sender, System.Configuration.Install.InstallEventArgs e) { var port = this.Context.Parameters["listen"]; var token = this.Context.Parameters["token"]; if (!String.IsNullOrEmpty(port) && !String.IsNullOrEmpty(token)) { var path = "\"" + Context.Parameters["assemblypath"] + "\" --listen " + port + " --token " + token; Console.WriteLine("New Path: {0}", path); Context.Parameters["assemblypath"] = path; } }
void SentryInstaller_AfterInstall(object sender, System.Configuration.Install.InstallEventArgs e) { using (ServiceController s = new ServiceController(serviceInstaller1.ServiceName)) { if (s.Status != ServiceControllerStatus.Running) { s.Start(); while (s.Status != ServiceControllerStatus.Running) { Console.WriteLine("Waiting for service to start - status {0}", s.Status.ToString()); Thread.Sleep(1000); s.Refresh(); } } } }
private void OnCommitted(object sender, System.Configuration.Install.InstallEventArgs e) { System.ServiceProcess.ServiceInstaller installer = (System.ServiceProcess.ServiceInstaller)sender; string serviceName = installer.ServiceName; string parameters = "/c sc failure \"" + serviceName + "\" reset= 0 actions=restart/5000/restart/5000/restart/5000"; // File.AppendAllText(@"C:\temp\install.log", "Adding recovery options " + parameters + "\n Name = " + serviceName + "\n"); try { Process.Start("cmd.exe", parameters); } catch (Exception) { // TODO log this to the event log } }
void ProjectInstaller_BeforeInstall(object sender, System.Configuration.Install.InstallEventArgs e) { List <ServiceController> services = new List <ServiceController>(ServiceController.GetServices()); foreach (ServiceController s in services) { if (s.ServiceName == this.serviceInstaller1.ServiceName) { ServiceInstaller ServiceInstallerObj = new ServiceInstaller(); ServiceInstallerObj.Context = new System.Configuration.Install.InstallContext(); ServiceInstallerObj.Context = Context; ServiceInstallerObj.ServiceName = "ServiceTPVATG"; ServiceInstallerObj.Uninstall(null); break; } } }
/// <summary> /// After install, start the service /// </summary> /// <param name="sender">Sender</param> /// <param name="e">InstallEventArgs object</param> private void serviceInstaller_AfterInstall(object sender, System.Configuration.Install.InstallEventArgs e) { // Get current privilege WindowsIdentity identity = WindowsIdentity.GetCurrent(); WindowsPrincipal principal = new WindowsPrincipal(identity); // Create event source if it does not exist, and we have administrator privileges if (principal.IsInRole(WindowsBuiltInRole.Administrator)) { if (!EventLog.SourceExists(Constants.System.NtServiceName)) { EventLog.CreateEventSource(Constants.System.NtServiceName, Constants.System.Application); } } ServiceController sc = new ServiceController(Constants.System.NtServiceName); sc.Start(); }
void ProjectInstaller_BeforeUninstall(object sender, System.Configuration.Install.InstallEventArgs e) { List <ServiceController> services = new List <ServiceController>(ServiceController.GetServices()); foreach (ServiceController s in services) { if (s.ServiceName == "MSB_Virus_Sentry") { if (s.Status != ServiceControllerStatus.Stopped) { s.Stop(); while (s.Status != ServiceControllerStatus.Stopped) { Thread.Sleep(1000); s.Refresh(); } } break; } if (s.ServiceName == "MSB_Sentry_Monitor") { if (s.Status != ServiceControllerStatus.Stopped) { s.Stop(); while (s.Status != ServiceControllerStatus.Stopped) { Thread.Sleep(1000); s.Refresh(); } } break; } } }
private void ServiceInstaller_AfterInstall(object sender, System.Configuration.Install.InstallEventArgs e) { ServiceController sc = new ServiceController(AIProbeService.NtName); sc.Start(); }
private void pumpServiceInstaller_AfterInstall(object sender, System.Configuration.Install.InstallEventArgs e) { // new ServiceController(pumpServiceInstaller.ServiceName).Start(); }
private void ProcessRelauncherInstaller_AfterInstall(object sender, System.Configuration.Install.InstallEventArgs e) { }
private void NetQualityTester_AfterInstall(object sender, System.Configuration.Install.InstallEventArgs e) { }
private void TradePlatformExperts_AfterInstall(object sender, System.Configuration.Install.InstallEventArgs e) { }
void NotificationWinServiceInstaller_Committed(object sender, System.Configuration.Install.InstallEventArgs e) { var controller = new ServiceController("COMOL_ErrorService"); controller.Start(); }
private void serviceInstaller1_AfterInstall(object sender, System.Configuration.Install.InstallEventArgs e) { }
private void AdvInstaller_AfterInstall(object sender, System.Configuration.Install.InstallEventArgs e) { }