Files
public-setupfiles/powershell_scripts/keep pc from sleeping or shutting down.ps1
WickedYoda 4d5c390d46 add playbooks and power shell scripts
add playbooks and power shell scripts
2026-10-21 12:59:57 -05:00

11 lines
311 B
PowerShell

$ErrorActionPreference = 'Stop'
foreach ($setting in @('standby-timeout-ac', 'standby-timeout-dc')) {
& powercfg.exe /change $setting 0
if ($LASTEXITCODE -ne 0) {
throw "Failed to set power setting '$setting'."
}
}
Write-Output 'Automatic sleep is disabled for the current power plan on AC and battery.'