powershell.exe -ExecutionPolicy Bypass -File .\keep-alive.ps1
Created
November 1, 2022 17:59
-
-
Save prayagupa/3dd220063f7c12fd35425defd627df98 to your computer and use it in GitHub Desktop.
powershell, awake
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear host | |
# https://cloudrun.co.uk/powershell/how-to-keep-your-screen-alive-or-pc-from-going-to-sleep-during-presentations/ | |
# Script to keep the PC alive, will prevent screen lock and sleep. | |
# Works by pressing Print Screen every 2 minutes, side effect is that a screenshot will overwrite the clipboard contents | |
# | |
write-warning "I am out for lunch." | |
Do { | |
[void][System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms') | |
[System.Windows.Forms.SendKeys]::SendWait("{F1}") | |
Start-Sleep -Seconds 120 | |
} While ($true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment