string UAC = GetRegKey("127.0.0.1", @"SOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem", "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; }
网上的方法有误...直接坑了我一下午。