Remote Registry

北慕城南 提交于 2019-12-02 18:03:21

问题


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 to 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.


回答1:


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.



来源:https://stackoverflow.com/questions/6253001/remote-registry

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!