A Windows CLI tool that prevents the system from sleeping and maintains Microsoft Teams presence.
- Prevents sleep — Uses the Win32
SetThreadExecutionStateAPI to stop Windows from idling, sleeping, or turning off the display. - Maintains Teams presence — Sends a periodic F15 keypress via
SendInputto reset the OS idle timer. Teams usesGetLastInputInfoto detect user activity, so this keeps your status as "Available". F15 is unmapped on modern keyboards and won't interfere with your work.
- Windows 10/11
- .NET 9 Runtime (or SDK)
dotnet tool install --global QuinntyneBrown.KeepAlive.Clidotnet tool update --global QuinntyneBrown.KeepAlive.Clidotnet tool uninstall --global QuinntyneBrown.KeepAlive.Clikeepalive| Option | Alias | Default | Description |
|---|---|---|---|
--interval |
-i |
30 |
Seconds between activity simulations |
--help |
-h |
Show help | |
--version |
Show version |
# Run with default 30-second interval
keepalive
# Run with a 60-second interval
keepalive -i 60Press Ctrl+C to stop. Normal power behaviour is restored on exit.
Default settings can be changed in appsettings.json alongside the tool binary:
{
"KeepAlive": {
"IntervalSeconds": 30
}
}Command-line options override appsettings.json values.
git clone https://github.com/QuinntyneBrown/KeepAlive.git
cd KeepAlive
dotnet builddotnet pack
dotnet tool install --global --add-source src/KeepAlive.Cli/nupkg QuinntyneBrown.KeepAlive.CliKeepAlive.sln
src/
KeepAlive.Cli/
Program.cs # Entry point, System.CommandLine setup, DI wiring
KeepAliveWorker.cs # BackgroundService — sleep prevention and input simulation
KeepAliveOptions.cs # Configuration POCO
NativeMethods.cs # Win32 P/Invoke declarations
appsettings.json # Default configuration