How do I pass credentials to a machine so I can use Microsoft.Win32.RegistryKey.OpenRemoteBaseKey()

Posted by JCCyC on Stack Overflow See other posts from Stack Overflow or by JCCyC
Published on 2010-03-29T21:46:47Z Indexed on 2010/03/29 21:53 UTC
Read the original article Hit count: 667

Filed under:
|
|
|
|

This .NET API works OK if I'm trying to open the Registry in a machine that's in the same domain as I am (and my logged-on user has admin rights on the target machine).

It gets tricky if it's an out-of-domain machine with a different, local administrative user (of whom I do have the password).

I tried to use WNetUseConnection() (which has served me well in the past in situations where what I wanted was to read a remote disk file) prior to calling OpenRemoteBaseKey(), but no dice -- I get an access denied exception.

Clearly, I must pass credentials some other way, but how?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about registry