using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Configuration.Install; using System.Linq; using System.Management; using System.Threading.Tasks; namespace RadeonResetBugFixService { [RunInstaller(true)] public partial class ProjectInstaller : System.Configuration.Install.Installer { public ProjectInstaller() { InitializeComponent(); } private void serviceInstaller1_AfterInstall(object sender, InstallEventArgs e) { ManagementObject wmiService = null; ManagementBaseObject InParam = null; try { wmiService = new ManagementObject($"Win32_Service.Name='{this.serviceInstaller1.ServiceName}'"); InParam = wmiService.GetMethodParameters("Change"); InParam["DesktopInteract"] = true; wmiService.InvokeMethod("Change", InParam, null); } finally { if (InParam != null) InParam.Dispose(); if (wmiService != null) wmiService.Dispose(); } } private void serviceProcessInstaller1_AfterInstall(object sender, InstallEventArgs e) { } } }