Fix Modern Standby check to be language-independant

This commit is contained in:
Raphire
2025-08-20 20:07:59 +02:00
parent b27971933e
commit b9de9b353d

View File

@@ -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. # Check if this machine supports S0 Modern Standby power state. Returns true if S0 Modern Standby is supported, false otherwise.
function CheckModernStandbySupport { function CheckModernStandbySupport {
$capture = $false $count = 0
try { try {
$null = switch -Regex (powercfg /a) { switch -Regex (powercfg /a) {
'The following sleep states are available on this system:' { ':' {
$capture = $true $count += 1
} }
'^\s{2,4}(Standby \(S0 Low Power Idle\))' { '(.*S0.{1,}\))' {
if($capture){ if ($count -eq 1) {
return $true return $true
} }
} }
'The following sleep states are not available on this system:' {
$capture = $false
}
} }
} }
catch { catch {
Write-Host "Error: Unable to check for S0 Modern Standby support, powercfg command failed" -ForegroundColor Red Write-Host "Error: Unable to check for S0 Modern Standby support, powercfg command failed" -ForegroundColor Red
Write-Output "" Write-Host ""
Write-Output "Press any key to continue..." Write-Host "Press any key to continue..."
$null = [System.Console]::ReadKey() $null = [System.Console]::ReadKey()
return $true return $true
} }