From 8bcef20bc256a0bb863fd19c2a90b03a9e02c7ca Mon Sep 17 00:00:00 2001 From: n00mkrad Date: Wed, 1 Sep 2021 11:08:34 +0200 Subject: [PATCH] GetGpus now always shows physical GPUs, even via RDP --- Code/Os/OsUtils.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Code/Os/OsUtils.cs b/Code/Os/OsUtils.cs index cbb8879..ce950dc 100644 --- a/Code/Os/OsUtils.cs +++ b/Code/Os/OsUtils.cs @@ -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 gpus = new List(); - 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);