Skip to content

Instantly share code, notes, and snippets.

@mminer
Created October 2, 2020 00: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 mminer/42d900ec668433ac81fe7f1cf8001b18 to your computer and use it in GitHub Desktop.
Save mminer/42d900ec668433ac81fe7f1cf8001b18 to your computer and use it in GitHub Desktop.
PowerShell script to keep Windows session alive by repeatedly toggling numlock.
$wshell = New-Object -ComObject WScript.Shell
while ($true) {
Write-Output "$(Get-Date) Toggling numlock"
$whell.SendKeys('{NUMLOCK}')
Start-Sleep -Seconds 10
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment