0

I'm trying to make a hardware monitizing program using C#. I have found the code to get the processor name on a Stack Overflow page. Now I want to get the GPU name, but I can't find the queries anywhere. I have looked around a lot, but because my school has really bad internet lately, 90% of all the pages don't load, so I am kinda lost at this point.

The code used:

public string GetCPUInfo()
{
    ManagementObjectSearcher mosProcessor = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
    string Procname = null;

    foreach (ManagementObject moProcessor in mosProcessor.Get())
    {
        if (moProcessor["name"] != null)
        {
            Procname = moProcessor["name"].ToString();
        }
    }
    lblCPUNameRdv.Text = Procname;
    return Procname;
}

Where can I find all the queries to use to get the specific piece of information?

Example =

SELECT * FROM Win32_Processor
klashar
  • 2,519
  • 2
  • 28
  • 38
  • 2
    http://superuser.com/questions/1089440/determine-what-gpu-is-running-through-wmi/1095198, http://www.activexperts.com/admin/scripts/wmi/powershell/ – CodeCaster Feb 22 '17 at 08:32
  • 1
    [Another tool](https://wmie.codeplex.com/) that might help you browsing through WMI – lokusking Feb 22 '17 at 08:33

1 Answers1

1

Use this link: How get GPU information in C#?

using System.Management;

public partial class Win_Win32_VideoController : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
ManagementObjectSearcher objvide = new ManagementObjectSearcher("select * from Win32_VideoController");

        foreach (ManagementObject obj in objvide.Get())
        {
            Response.Write("Name  -  " + obj["Name"] + "</br>");
            Response.Write("DeviceID  -  " + obj["DeviceID"] + "</br>");
            Response.Write("AdapterRAM  -  " + obj["AdapterRAM"] + "</br>");
            Response.Write("AdapterDACType  -  " + obj["AdapterDACType"] + "</br>");
            Response.Write("Monochrome  -  " + obj["Monochrome"] + "</br>");
            Response.Write("InstalledDisplayDrivers  -  " + obj["InstalledDisplayDrivers"] + "</br>");
            Response.Write("DriverVersion  -  " + obj["DriverVersion"] + "</br>");
            Response.Write("VideoProcessor  -  " + obj["VideoProcessor"] + "</br>");
            Response.Write("VideoArchitecture  -  " + obj["VideoArchitecture"] + "</br>");
            Response.Write("VideoMemoryType  -  " + obj["VideoMemoryType"] + "</br>");
        }
    }
}

Thanks

Community
  • 1
  • 1
Brijesh
  • 369
  • 2
  • 10
  • Even tho, this is what i need to continue coding, this isnt really the awnser i was looking for. I am looking for the location where i can find the queries needed to search up this information. – Robbert de Vries Feb 23 '17 at 07:47
  • Go through this article & Try to google out WQL Queries. https://dotnetcodr.com/2014/11/21/finding-all-wmi-class-names-within-a-wmi-namespace-with-net-c/. There are a lot of resources available on net. – Brijesh Feb 23 '17 at 08:20