以编程方式获取Windows体验索引值

时间:2011-07-20 12:32:01

标签: c# .net windows wmi

  

可能重复:
  Retrieve Windows Experience Rating

使用.NET,有没有办法以编程方式查询Windows体验索引的当前值?

2 个答案:

答案 0 :(得分:3)

希望StackOverflow引擎不会将其转换为自动更新。

请参阅this Stack Overflow答案:

答案 1 :(得分:2)

另一个选项是使用WinSAT Interfaces执行此任务,请查看IProvideWinSATResultsInfo界面以获取更多信息以及WMI类Win32_WinSAT

检查此示例代码

using System;
using System.Collections.Generic;
using System.Management;
using System.Text;

namespace ConsoleApplication13
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                ManagementObjectSearcher searcher =
                    new ManagementObjectSearcher("root\\CIMV2",
                    "SELECT * FROM Win32_WinSAT");

                foreach (ManagementObject queryObj in searcher.Get())
                {
                    Console.WriteLine("CPUScore: {0}", queryObj["CPUScore"]);
                    Console.WriteLine("D3DScore: {0}", queryObj["D3DScore"]);
                    Console.WriteLine("DiskScore: {0}", queryObj["DiskScore"]);
                    Console.WriteLine("GraphicsScore: {0}", queryObj["GraphicsScore"]);
                    Console.WriteLine("MemoryScore: {0}", queryObj["MemoryScore"]);
                    Console.WriteLine("TimeTaken: {0}", queryObj["TimeTaken"]);
                    Console.WriteLine("WinSATAssessmentState: {0}", queryObj["WinSATAssessmentState"]);
                    Console.WriteLine("WinSPRLevel: {0}", queryObj["WinSPRLevel"]);
                }
            }
            catch (ManagementException e)
            {
                Console.WriteLine(e.Message);
            }
            Console.Read();
        }
    }
}