From b9de9b353d78f1ebe8bd4f8e6ac25cbdb145b834 Mon Sep 17 00:00:00 2001 From: Raphire <9938813+Raphire@users.noreply.github.com> Date: Wed, 20 Aug 2025 20:07:59 +0200 Subject: [PATCH] Fix Modern Standby check to be language-independant --- Win11Debloat.ps1 | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/Win11Debloat.ps1 b/Win11Debloat.ps1 index f0eceb8..d4b002f 100644 --- a/Win11Debloat.ps1 +++ b/Win11Debloat.ps1 @@ -544,29 +544,25 @@ function Strip-Progress { # Check if this machine supports S0 Modern Standby power state. Returns true if S0 Modern Standby is supported, false otherwise. function CheckModernStandbySupport { - $capture = $false - + $count = 0 + try { - $null = switch -Regex (powercfg /a) { - 'The following sleep states are available on this system:' { - $capture = $true + switch -Regex (powercfg /a) { + ':' { + $count += 1 } - - '^\s{2,4}(Standby \(S0 Low Power Idle\))' { - if($capture){ + + '(.*S0.{1,}\))' { + if ($count -eq 1) { return $true } } - - 'The following sleep states are not available on this system:' { - $capture = $false - } } } catch { Write-Host "Error: Unable to check for S0 Modern Standby support, powercfg command failed" -ForegroundColor Red - Write-Output "" - Write-Output "Press any key to continue..." + Write-Host "" + Write-Host "Press any key to continue..." $null = [System.Console]::ReadKey() return $true }