public override void Execute(HostArguments args)
        {
            if (!ServiceUtils.IsServiceInstalled(args.ServiceName))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Out.WriteLine("The '{0}' service is not installed.", args.ServiceName);
                Console.ResetColor();

                return;
            }

            var stopController = new ServiceController(args.ServiceName);

            if (stopController.Status == ServiceControllerStatus.Running)
            {
                stopController.Stop();
                stopController.WaitForStatus(ServiceControllerStatus.Stopped);
            }
            if (stopController.Status != ServiceControllerStatus.Running)
            {
                stopController.Start();
                stopController.WaitForStatus(ServiceControllerStatus.Running);
            }

            Console.Out.WriteLine("Service restarted");    
        }
        public override void Execute(HostArguments args)
        {
            if (!Settings.ForwardAuditMessages.HasValue)
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("Installation Aborted!");
                Console.ResetColor();
                Console.WriteLine(@"
            This installation requires addition information:

            ForwardAuditMessages must be explicitly set to true or false

            e.g.

              ServiceControl.exe -install -d=""ServiceControl/ForwardAuditMessages==true""

            For more information go to the documentation site - http://docs.particular.net
            and search for 'ServiceControl ForwardAuditMessages'
            ");
                Environment.Exit(1);
            }
        }
 public HostInstaller(HostArguments settings, string arguments, Installer[] installers)
 {
     this.installers = installers;
     this.arguments = arguments;
     this.settings = settings;
 }
 public override void Execute(HostArguments args)
 {
     bootstrapper = new Bootstrapper(null, args);
     bootstrapper.Start();
 }
 public HostInstaller(HostArguments settings, string arguments, Installer[] installers)
 {
     this.installers = installers;
     this.arguments  = arguments;
     this.settings   = settings;
 }