0

C# や WMI を使用して Bluetooth ドライバーをプログラムで無効化または停止する方法は? 名前空間 Win32_NetworkAdapter にあるメソッド「Disable」を試しましたが、役に立たないようです。

ここに私がやったことの例があります:

ManagementObject classInstance =
                new ManagementObject("\\root\\cimv2",
                "Win32_NetworkAdapter.DeviceID='16'",
                null);

            // no method in-parameters to define


            // Execute the method and obtain the return values.
            ManagementBaseObject outParams =
                classInstance.InvokeMethod("Disable", null, null);

            // List outParams
            Console.WriteLine("Out parameters:");
            Console.WriteLine("ReturnValue: " + outParams["ReturnValue"]);

アイデアをありがとう!

upd: WIN32_SystemDriver オブジェクトで StopService を呼び出そうとしましたが、エラー コード 4 が返されます。

4

0 に答える 0