ManagementObjectSearcher无法正常工作

时间:2014-03-23 11:57:10

标签: c# .net windows winapi com

我正在尝试获取有关RSOP_SecuritySettingBoolean的一些信息,但它会返回一个空集合。难道我做错了什么?没有域名的Win7 x64 HP:

        var options = new ConnectionOptions();
        var scope = new ManagementScope(@"\\.\root\RSOP\Computer", options);

        var objectQuery = new ObjectQuery("SELECT * FROM RSOP_SecuritySettingBoolean");
        using (var searcher = new ManagementObjectSearcher(scope, objectQuery))
        {
            foreach (ManagementObject o in searcher.Get())
            {
                Console.WriteLine("Key Name: {0}", o["KeyName"]);
                Console.WriteLine("Precedence: {0}", o["Precedence"]);
                Console.WriteLine("Setting: {0}", o["Setting"]);
            }
        }

0 个答案:

没有答案