C#C
C#3y ago
yz

❔ Problem with getting GPU info

I'm currently working on a console program that shows some information of user's PC for fun.
I have a problem with getting GPU info, when user is using laptop. In my case, I have RTX on my laptop but the program only shows Intel UHD.
How to get REAL GPU information? Not only the name of RTX, I am gonna need more information like temperatures, or etc.

This is a part of my code.
internal class GPUInfo
    {
        public string Name { get; private set; }
        public string DriverVersion { get; private set; }
        public GPUInfo()
        {
            Name = string.Empty;
            DriverVersion = string.Empty;
        }
        public void Update()
        {
            using (var searcher = new ManagementObjectSearcher("select * from Win32_VideoController"))
            {
                foreach (var obj in searcher.Get())
                {
                    Name = obj["Name"] != null ? obj["Name"].ToString() : "Unknown";
                    DriverVersion = obj["DriverVersion"] != null ? obj["DriverVersion"].ToString() : "Unknown";
                }
            }
        }
    }
Was this page helpful?