I'm trying to change Intel network adapter settings using WMI. Accessing the classes works fine but according to the Intel documentation page 40 i need to call two methods in order to apply those changes.
So the IANet_NetService class should have the methods BeginApply and Apply. When I check this using PowerShell command get-wmiobject -namespace root\intelncs2 -class IAnet_NetService | get-member
I can confirm that these methods are present.
The Intel documentation says I should enumerate the single instance in IANet_NetService.
So when I use CreateInstanceEnum
method it will give me one result in the enumeration, but when I try to enumerate the methods for this instance, it won't find any.
Later I tried to use CreateClassEnum
which had no results.
At last I tried a simple GetObject
call to get the IANet_NetService item. With this item I was also able to enumerate the methods and find the BeginApply and Apply methods.
It is also possible to call GetMethod
to receive the signature information. For the BeginApply method it has no input parameters which is correct according to the Intel docs. So I try to execute this method using pService->ExecMethod(L"IAnet_NetService", L"BeginApply", 0, 0, 0, &pOutInst, 0);
which return WBEM_E_INVALID_METHOD_PARAMETERS
. MSDN says this may be returned when the input parameters are wrong or I'm missing a [static] qualifier on the method.
The input parameters are correct, but I do not know what the missing [static] qualifier means in this case.
Anyone knows how to call this method?
The problem was, that i needed to use the GetObject/GetMethod
combination to retrieve the input parameters and after this get the only instance of the object and ask for it's path. This path replaced L"IAnet_NetService"
on the ExecMethod
call and it's working.