stop your computer from locking

Copper Contributor

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}")
}
0 Replies