WMI 远程修改服务启动类型
ConnectionOptions options = new ConnectionOptions();
options.Username = UserName;
options.Password = PassWord;
options.Username = UserName;
options.Password = PassWord;
ManagementScope Conn = new ManagementScope(@"\\" + IP + @"\root\cimv2", options);
Conn.Connect();
ManagementPath path = new ManagementPath("Win32_Process");
ManagementClass processClass = new ManagementClass(Conn, path, null);
ManagementBaseObject inParams = processClass.GetMethodParameters("ChangeStartMode");
//Parameters for creation of process.
inParams["StartMode"] = "Auto";
//Invoke Method.
ManagementBaseObject outParams = processClass.InvokeMethod("ChangeStartMode", inParams, null);