您的位置:首页 > 其它

读取远程注册表键值

2014-04-17 20:00 218 查看
string UAC = GetRegKey("127.0.0.1", @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "LocalAccountTokenFilterPolicy");
private static string GetRegKey(string ClientIP, string path, string key)
{
string result = "";
try
{
RegistryKey regKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, ClientIP).OpenSubKey(path);
result = regKey.GetValue(key).ToString();
regKey.Close();
}
catch (Exception ex)
{
result = ex.ToString();
}
return result;
}


网上的方法有误...直接坑了我一下午。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: