GetGpus now always shows physical GPUs, even via RDP

This commit is contained in:
n00mkrad
2021-09-01 11:08:34 +02:00
parent f81d135bdf
commit 8bcef20bc2

View File

@@ -270,20 +270,15 @@ namespace Flowframes.Os
public static string GetGpus ()
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_DisplayConfiguration");
ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_DisplayControllerConfiguration");
List<string> gpus = new List<string>();
foreach (ManagementObject mo in searcher.Get())
foreach (ManagementObject queryObj in searcher.Get())
{
foreach (PropertyData property in mo.Properties)
{
if (property.Name == "Description")
{
gpus.Add(property.Value.ToString());
Logger.Log($"[GetGpus] Found GPU: {property.Value}", true);
}
}
string gpuName = queryObj["Name"].ToString();
gpus.Add(gpuName);
Logger.Log($"[GetGpus] Found GPU: {gpuName}", true);
}
return string.Join(", ", gpus);