Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function Caffeinate {
$active_scheme_id = (powercfg /GetActiveScheme).Split(" ")[3]
$high_perf_id = "8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c"
powercfg /s $high_perf_id
if ($LASTEXITCODE -ne 0) { return }
try {
& $ScriptBlock
} finally {
powercfg /s $active_scheme_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.