This DLL does not have this call, so this way will fail to search by this name in the library.
According to the documentation of Microsoft this method is not implemented by WMI.
If this method were implemented the code to call it, it would be this:
using System;
using System.Text;
using System.Management;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
ManagementClass fanClass = new ManagementClass("CIM_Fan");
ManagementBaseObject inParams = fanClass.GetMethodParameters("SetSpeed");
inParams["DesiredSpeed"] = 1000;
ManagementBaseObject outParams = fanClass.InvokeMethod("SetSpeed", inParams, null);
Console.WriteLine("SetSpeed to 1000. returned: " + outParams["returnValue"]);
}
}
}
But the code fails to execute the method InvokeMethod
because the method is not implemented.
Recalling that it is necessary to include an Assembly reference in the project for System.Management
.
Code based in this example.
EDITION:
It seems that it is not possible without writing a driver for Windows, according to this question in the OS.
The same mistake happened to me. You know another way to try to control Fan by c#?
– Butzke
I edited the answer, it doesn’t seem possible without writing a driver =/
– Vargas