PSCaffeinate
1.1.0
PSCaffeinate prevents Windows from sleeping -- a drop-in equivalent of the macOS caffeinate command. Supports all major caffeinate flags (-d, -i, -s, -u), timeout (-t), wait-for-PID (-w), and running a subprocess, using the Win32 SetThreadExecutionState API. Exports Invoke-Caffeinate with the alias caffeinate.
Minimum PowerShell version
5.1
Installation Options
Owners
Copyright
(c) 2026 Ray Piller. MIT License.
Package Details
Author(s)
- Ray Piller
Tags
caffeinate sleep power idle display Windows productivity SetThreadExecutionState
Functions
PSEditions
Dependencies
This module has no dependencies.
Release Notes
v1.1.0 - Fix: ES_USER_PRESENT is deprecated on modern Windows and caused SetThreadExecutionState to silently fail; -u now substitutes display + idle-sleep prevention. Fix: POSIX-style bundled flags (caffeinate -disu) now work via a wrapper function with hashtable splatting. Added return-value checking and periodic re-assertion of sleep prevention every 30s.
FileList
- PSCaffeinate.nuspec
- PSCaffeinate.psd1
- PSCaffeinate.psm1
Version History
| Version | Downloads | Last updated |
|---|---|---|
| 1.1.0 (current version) | 4 | 5/9/2026 |
| 1.0.0 | 4 | 5/9/2026 |