Skip to content

Instantly share code, notes, and snippets.

@RitamChakraborty
Last active November 28, 2020 03:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RitamChakraborty/48dfb606944ebfaa9dea5436dddfbb24 to your computer and use it in GitHub Desktop.
Save RitamChakraborty/48dfb606944ebfaa9dea5436dddfbb24 to your computer and use it in GitHub Desktop.
Stops windows computer from going to sleep. Handy for corporate machines which has automatic sleep enabled by the admin, and changing the settings doesn't work. Run the script with PowerShell ISE and enjoy.
$i = 0
while ($true) {
[System.Windows.Forms.SendKeys]::SendWait("{F5}")
Start-Sleep -s 60
$i++;
$text = ""
if ($i -eq 1) {
$text = "minute has"
} else {
$text = "minutes have"
}
echo "$i $text passed"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment