开发者

Remote Registry

I know this has been talked about a few times about remote registry access, but I cannot find any good examples on how to implement this.

I did find http://www.codeproject.com/KB/cs/cpimpersonation1.aspx which seems to have code that will do what I want, however, this seems to be connecting to the same PC where the app is running from. What I want is t开发者_StackOverflow社区o connect to remote PC in a different domain.

I have been doing some reading but cannot figure out how to modify this code to do so.

Any help would be appreciated on how to use the code to connect to a remote pc.


You can start from this article: RegistryKey.OpenRemoteBaseKey. But you user account should be allowed to operate with registry on this remote machine! And impersonation is not the best way to resolve your task. LogonUser creates new security context on that machine where it is called. This means that user with permissions to access remote registry also should have permission to logon locally. This is very strong requirement.

I propose alternative solution: Before accessing registry you can use WNetAddConnection2 to create connection to IPC$ share on remote computer using credentials of user that have proper rights to access registry. Don't forget to cancel the connection when you finish your work with registry.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜