Skip to content

Instantly share code, notes, and snippets.

View Dan-Yaw's full-sized avatar
🏠
Working from home

Daniel Yaw Dan-Yaw

🏠
Working from home
  • Esri
  • Philadelphia Area
  • 13:48 (UTC -04:00)
View GitHub Profile
@Dan-Yaw
Dan-Yaw / keepawake.ps1
Created May 8, 2021 19:46 — forked from jamesfreeman959/keepawake.ps1
A very simple PowerShell script to keep a Windows PC awake and make lync think the user is active on the keyboard
# Useful references:
#
# https://superuser.com/questions/992511/emulate-a-keyboard-button-via-the-command-line
# https://ss64.com/vb/sendkeys.html
# https://social.technet.microsoft.com/Forums/windowsserver/en-US/96b339e2-e9da-4802-a66d-be619aeb21ac/execute-function-one-time-in-every-10-mins-in-windows-powershell?forum=winserverpowershell
# https://learn-powershell.net/2013/02/08/powershell-and-events-object-events/
#
# Future enhancements - use events rather than an infinite loop
while (1) {
$wsh = New-Object -ComObject WScript.Shell