[DllImport("CIMWin32.dll")]
public static extern UInt32 Reset();
When I Am Calling This Method Then I Getting Exception
Unable to find an entry point named 'Reset' in DLL 'CIMWin32.dll'
[DllImport("CIMWin32.dll")]
public static extern UInt32 Reset();
When I Am Calling This Method Then I Getting Exception
Unable to find an entry point named 'Reset' in DLL 'CIMWin32.dll'
I'm not sure what Reset
method of CIM
you want to import and invoke, but this is how you can call a method in VMI
. Install System.Management package via NuGet. Then you need to create an instance of ManagementClass
like below:
var NamespacePath = "\\\\.\\ROOT\\cimv2";
var ClassName = "CIM_LogicalDevice";
ManagementClass managementClass = new ManagementClass(NamespacePath + ":" + ClassName);
managementClass .InvokeMethod("Reset", null);
Of course in the code above, Reset
method is not implemented. You can find your provider, class, and method in Microsoft Docs. For e.g above, I tried to call the Reset
method of CIM_LogicalDevice
class.
In the requirement section, you can see the namespace.
If you look for the more complicated example of how to invoke WMI class methods, take a look on this example on Microsoft Docs: https://learn.microsoft.com/en-us/configmgr/develop/core/clients/programming/how-to-call-a-wmi-class-method-by-using-system.management