473,398 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

WMI SystemDriver

Ulf
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);

Jan 16 '06 #1
0 1870

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.