DEV Community

Teoman Ege Selcuk
Teoman Ege Selcuk

Posted on

PowerShell on Windows 11 Home: How to cap Display/Sleep/Hibernate at 5 minutes (300 s) regardless of user changes?

I can set idle timers with powercfg (e.g., 2–3 minutes for Sleep/Hibernate) on Windows 11 Home and they apply fine.

I need to enforce a maximum of 5 minutes so users (incl. local admins) can pick shorter timeouts but not exceed 300 seconds for:

VIDEOIDLE (Turn off display after)

STANDBYIDLE (Sleep after)

HIBERNATEIDLE (Hibernate after)

Environment/limits: Win11 Home, AC/DC, no GPO/AppLocker. Browser keep-awake is already handled separately with /requestsoverride.

Tried:

Just writing values → can be raised later.

A crude clamp that parses powercfg /q → unreliable with plan changes/locales.

Looking for: A PowerShell solution (preferably a SYSTEM scheduled task) that clamps to 300 s on the active plan and survives plan switches and GUI/powercfg edits, ideally using GUIDs/APIs rather than parsing localized output. Minimal example appreciated.

Top comments (0)