using Microsoft.Win32; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace VMwareLauncher { public class ServiceControl { public static readonly List DefaultVmwareServices = new List { "VMnetDHCP", "VMUSBArbService", "VMware NAT Service", "VMwareHostd", "VMAuthdService" }; //Array of services to close public List ServiceList { get; set; } public bool ForceServicesManual() { bool errors = false; string winServices = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services"; try { foreach (var service in ServiceList) { string currentService = winServices + "\\" + service; if ((int)Registry.GetValue(currentService, "Start", null) != 3) { Registry.SetValue(currentService, "Start", 3); } } } catch (Exception) { errors = true; throw; } return errors; } } }