Keep your computer awake using Start-KeepAwake
There are many ways you can keep your machine awake. Utilities like Caffeine and PowerToys do an amazing job however they sometimes get blocked by Anti-virus programs. Having a machine stay logged in is important for programs like BluePrism which handles many types of Automations.
That got me thinking, I wonder if I could write my own custom code that could do a similar job. I like how easy both of those applications were. Many of the other items I looked at online were not very feature rich.
Enter my new utility… Start-KeepAwake.
At it’s heart, it works almost identically to Caffeine. Essentially it presses “Shift+F15” every so often at a random interval vetween 1 and 5 minutes. That Key Combo doesn’t really do anything on modern computers.
The only time you may want to stop the utility is if you are in “Putty”. I know with Caffeine a special character will show up in Putty when the key combo is pressed. I have not tried my utility with Putty yet.
The utility is written in PowerShell and I also created a compiled version for the people that don’t want to run powershell code.
Executable Link - Start-KeepAwake.exe
PowerShell Code - Start-KeepAwake.ps1
Examples:
# 1.) Keep awake for 1hr
Start-KeepAwake.exe -hours 1
or
.\Start-KeepAwake.ps1 -Hours 1
# 2.) Keep awake for 30 minutes
Start-KeepAwake.exe -hours .5
or
.\Start-KeepAwake.ps1 -Hours .5
# 3.) Keep awake for 7hrs and 15 minutes with a pause
Start-KeepAwake.exe -hours 7.25 -pause
or
.\Start-KeepAwake.ps1 -Hours 7.25 -pause
# 4.) Keep awake for 7hrs and 15 minutes
Start-KeepAwake.exe -hours 7.25
or
.\Start-KeepAwake.ps1 -Hours 7.25