/// <summary> /// Uninstalls a service from a computer /// </summary> /// <param name="name">The name that identifies the service to the system.</param> /// <param name="computer">The computer on which the service resides.</param> /// <returns>If the service was uninstalled.</returns> public bool Uninstall(string name, string computer = "") { if (String.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } if (this.ServiceExists(name, computer)) { PowershellSettings powerSettings = new PowershellSettings() { FormatOutput = true, LogOutput = true }.WithArguments(args => { args.AppendQuoted(name); }); if (!String.IsNullOrEmpty(computer)) { powerSettings.ComputerName = computer; } _PowershellRunner.Start("& \"sc.exe\" delete", powerSettings); return(true); } else { return(false); } }