Skip to content

Instantly share code, notes, and snippets.

@raresteak
Created January 22, 2021 13:23
Show Gist options
  • Save raresteak/82248393f3927a118dfec184fbcb6be1 to your computer and use it in GitHub Desktop.
Save raresteak/82248393f3927a118dfec184fbcb6be1 to your computer and use it in GitHub Desktop.
Simulate key press - keep screen from locking
$WShell = New-Object -com "Wscript.Shell"
while ($true)
{
Echo "Key press"
$WShell.sendkeys("{SCROLLLOCK}")
Start-Sleep -Milliseconds 100
$WShell.sendkeys("{SCROLLLOCK}")
Start-Sleep -Seconds 300
}
# Original author https://gist.github.com/AndrewDavis, https://gist.github.com/MatthewSteeples/ce7114b4d3488fc49b6a#gistcomment-2946126
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment