From 5b369250b67d1dd77f08d0d9b7c964d53ef59740 Mon Sep 17 00:00:00 2001 From: Justawildwolf <62820836+blusewill@users.noreply.github.com> Date: Fri, 28 Jun 2024 14:52:25 +0000 Subject: [PATCH] Update GPU Whitelist System (#2178) * Compile Winutil * Update Invoke-WinUtilGPU.ps1 * Re-Formate 'Invoke-WinUtilGPU.ps1' Private Function to be Shorter * Refactor @blueswills changes * Change Date to allow for easy merge --------- Co-authored-by: Marterich Co-authored-by: Mr.k Co-authored-by: Martin Wiethan <47688561+Marterich@users.noreply.github.com> --- functions/private/Invoke-WinUtilGPU.ps1 | 36 ++++++++++--------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/functions/private/Invoke-WinUtilGPU.ps1 b/functions/private/Invoke-WinUtilGPU.ps1 index e5436f82..13e4fb76 100644 --- a/functions/private/Invoke-WinUtilGPU.ps1 +++ b/functions/private/Invoke-WinUtilGPU.ps1 @@ -1,29 +1,21 @@ function Invoke-WinUtilGPU { $gpuInfo = Get-CimInstance Win32_VideoController - - foreach ($gpu in $gpuInfo) { - $gpuName = $gpu.Name - if ($gpuName -like "*NVIDIA*") { - return $true # NVIDIA GPU found - } - } + + # GPUs to blacklist from using Demanding Theming + $lowPowerGPUs = ( + "*NVIDIA GeForce*M*", + "*NVIDIA GeForce*Laptop*", + "*NVIDIA GeForce*GT*", + "*AMD Radeon(TM)*", + "*UHD*" + ) foreach ($gpu in $gpuInfo) { - $gpuName = $gpu.Name - if ($gpuName -like "*AMD Radeon RX*") { - return $true # AMD GPU Found - } - } - foreach ($gpu in $gpuInfo) { - $gpuName = $gpu.Name - if ($gpuName -like "*UHD*") { - return $false # Intel Intergrated GPU Found - } - } - foreach ($gpu in $gpuInfo) { - $gpuName = $gpu.Name - if ($gpuName -like "*AMD Radeon(TM)*") { - return $false # AMD Intergrated GPU Found + foreach ($gpuPattern in $lowPowerGPUs){ + if ($gpu.Name -like $gpuPattern) { + return $false + } } } + return $true } \ No newline at end of file