Im trying to use Jacob library
to read registry values from remote machine and im trying to use the GetStringValue
im have the following code
@Test
public void executeWmiSpecificCommand() {
//ActiveXComponent wmi = new ActiveXComponent("WbemScripting.SWbemLocator");
ActiveXComponent mActiveXWMI = new ActiveXComponent("winmgmts:\\\\localhost\\root\\default:StdRegProv");
int HKEY_LOCAL_MACHINE = 0x80000002;
Variant baseKey = new Variant(HKEY_LOCAL_MACHINE,true);
Variant keyName = new Variant("SOFTWARE\\myProgram",true);
Variant keyValue = new Variant("name",true);
Variant response = new Variant("",false);
Variant vCollection = mActiveXWMI.invoke("GetStringValue", baseKey, keyName, keyValue, response);
EnumVariant enumVariant = new EnumVariant(vCollection.toDispatch());
Dispatch item = null;
while (enumVariant.hasMoreElements()) {
item = enumVariant.nextElement().toDispatch();
String PropertyName = Dispatch.call(item, "sValue").toString();
System.out.println(PropertyName );
}
ComThread.Release();
}
I can finally call the method but i always get the following error
com.jacob.com.ComFailException: A COM exception has been encountered: At Invoke of: GetStringValue Description: 80020010 / Invalid callee.
Im pretty sure that im passing the correct parameters and their types but i have no idea for what is this error message
User contributions licensed under CC BY-SA 3.0