WMI SystemDriver

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ulf

    #1

    WMI SystemDriver

    Hi all,

    when trying to use the Win32_SystemDri ver StopService call on an Intel
    PRO/1000 network adapter, I always get the return error code <4>. Yet
    using the "ChangeStartMod e" to disable or even "StartServi ce" 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_SystemD river");

    foreach (ManagementObje ct mo in mc.GetInstances ())
    {
    if (mo["DisplayNam e"].ToString().Ind exOf("PRO/1000") >= 0)
    {
    ManagementBaseO bject inPar =
    mc.GetMethodPar ameters("Change StartMode");
    inPar["StartMode"] = "Manual";
    ManagementBaseO bject outPar = mo.InvokeMethod ("ChangeStartMo de",
    inPar, null);
    res += "ChangeStartMod e returns : " +
    outPar["ReturnValu e"].ToString() + "\n";
    inPar = null;
    outPar = mo.InvokeMethod ("StopServic e", inPar, null);
    res += "StopServic e returns : " +
    outPar["ReturnValu e"].ToString();
    }
    }
    MessageBox.Show (res);

Working...