Skip to content

Instantly share code, notes, and snippets.

@falldeaf
Created November 24, 2020 17:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save falldeaf/89ccc1775239237d5b49ffca25aeb7f8 to your computer and use it in GitHub Desktop.
Save falldeaf/89ccc1775239237d5b49ffca25aeb7f8 to your computer and use it in GitHub Desktop.
PowerShell script to keep your locked down computer from going to sleep
Clear-Host
Echo "Keep-alive with Scroll Lock..."
$WShell = New-Object -com "Wscript.Shell"
while ($true)
{
$WShell.sendkeys("{SCROLLLOCK}")
Start-Sleep -Milliseconds 100
$WShell.sendkeys("{SCROLLLOCK}")
Start-Sleep -Seconds 240
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment