Identifying the GPU using C#
public static String GetGPU()
{
	ManagementObjectSearcher mos = 
		new ManagementObjectSearcher("SELECT * FROM Win32_DisplayConfiguration");
 
	String GPU = "";
	foreach (ManagementObject mo in mos.Get())
		foreach (PropertyData property in mo.Properties)
			if (property.Name == "Description")
				GPU = property.Value.ToString();
	return GPU;
}

According to Microsoft, Win32_DisplayConfiguration is obsolete for Windows newer than Windows Vista. But it still works for Windows 7 and Windows 8.

Option 2

public static String GetGPU()
{
	ManagementObjectSearcher mos =
		new ManagementObjectSearcher("SELECT * FROM Win32_VideoController");
 
	String GPU = "";
	foreach (ManagementObject mo in mos.Get())
		foreach (PropertyData property in mo.Properties)
			if (property.Name == "Caption")
				GPU += property.Value.ToString() + " ";
	return GPU;
}
Categories: C# Tags: , , , ,
%d bloggers like this: