Hi all,
when trying to use the Win32_SystemDriver StopService call on an Intel
PRO/1000 network adapter, I always get the return error code <4>. Yet
using the "ChangeStartMode" to disable or even "StartService" methods
while in manual StartMode works perfectly. I already checked the
AcceptStop property, which returns true.
Honestly I have no idea why calling the StopService method (and
StopService only) returns an error code.
Any ideas ?
thx :)
Ulf
ManagementClass mc = new ManagementClass("Win32_SystemDriver");
foreach (ManagementObject mo in mc.GetInstances())
{
if (mo["DisplayName"].ToString().IndexOf("PRO/1000") >= 0)
{
ManagementBaseObject inPar =
mc.GetMethodParameters("ChangeStartMode");
inPar["StartMode"] = "Manual";
ManagementBaseObject outPar = mo.InvokeMethod("ChangeStartMode",
inPar, null);
res += "ChangeStartMode returns : " +
outPar["ReturnValue"].ToString() + "\n";
inPar = null;
outPar = mo.InvokeMethod("StopService", inPar, null);
res += "StopService returns : " +
outPar["ReturnValue"].ToString();
}
}
MessageBox.Show(res);