Jinterop impersonation

318 Views Asked by At

I use the Jinterop library for an access to remote WMI.

JISystem.setAutoRegisteration(true);
JISession session = JISession.createSession(System.getenv("USERDOMAIN"), login, password);
session.useSessionSecurity(true);
final JIComServer server = new JIComServer(JIProgId.valueOf(WBEM_PROGID), HOST, session);

I want to use impersonation for accessing with current user and password to remote machine. But when I use empty login and password, I always get exception

jcifs.smb.SmbAuthException: Logon failure: unknown user name or bad password.
    at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:546)

Is this possible to use impersonation in Jinterop?

1

There are 1 best solutions below

0
On

I am not 100% sure, but I have worked with j-interop for some time and I have never seen or read about this feature, so I don't think that this is possible. In my opinion you always have to specify the credentials.

Further, I am curious if this is really working for you?:

JISystem.setAutoRegisteration(true);

This means that j-interop will automatically try to modify values/keys in the registry as needed. In my experience, in case you want to access the WbemScripting.SWbemLocator class, due to tighter security constraints (the necessary keys are owned by the 'TrustedInstaller' user) this automatic modification is not possible any more starting from Windows Vista and above. I always had to set this to false and modify the values/keys manually in the registry.