Forum Discussion

HenryBrown's avatar
HenryBrown
Copper Contributor
Sep 14, 2024

stop your computer from locking

This is a useful trick to stop your computer from locking.

 

Code:
param($minutes = 9999)

write "... screen will be awake for $minutes"

 $myshell = New-Object -com "Wscript.Shell"

 for ($i = 0; $i -lt $minutes; $i++) {
 write "... screen will be awake for" ($minutes-$i)
 Start-Sleep -Seconds 60   
 $myshell.sendkeys("{NUMLOCK}{NUMLOCK}")
}
No RepliesBe the first to reply

Resources