远程注册表 [英] Remote Registry

查看:176
本文介绍了远程注册表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这已经讲了有关远程注册表访问了几次,但我不能找到如何落实这一任何很好的例子。



我确实发现< A HREF =htt​​p://www.codeproject.com/KB/cs/cpimpersonation1.aspx相对=nofollow> http://www.codeproject.com/KB/cs/cpimpersonation1.aspx 这似乎有代码,将做我想做的,但是,这似乎是连接到应用从运行在同一台PC。我要的是连接到远程计算机在不同的领域。



我一直在做一些阅读,但无法弄清楚如何修改此代码这样做。



任何帮助将如何使用代码连接到远程PC赞赏。


解决方案< RegistryKey.OpenRemoteBaseKey

您可以从本文开始>。
但是你的用户帐户应允许该远程计算机上的注册表与操作!
和模仿不是解决你的任务的最佳方式。 LogonUser的创建机器其中它被称为新的安全性上下文。这意味着,与权限用户访问远程注册表也应该有允许本地登录。这是非常强烈的要求。



我提出另一种解决方案:
访问注册表,您可以使用的
WNetAddConnection2 创建使用具有适当的权限访问的用户凭据远程计算机上连接到IPC $共享注册表。不要忘了,当你完成与登记工作,以取消连接。


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.

解决方案

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.

这篇关于远程注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆