Shutdown Windows when idle

Apr 27, 2022 15:35

You can turn on hibernation - but it has obvious downsides, takes space on disk, reduces life of SSD, increases instability.
So better - full shutdown on idle.
In Windows there is an Idle event - but it's broken. It will try to shutdown your PC immediately. Even though u set it to wait 1 hour.
So, you turn on screensaver (any, blank preferably), it will generate an event, which you can track and shutdown PC. But. In Windows 10 screen saver events do not get logged automatically. You need to turn on the audit.


Enable screen saver at 60 min.

Enable audit of screen saver:
gpedit.msc

Local Computer Policy
Computer Configuration
Windows Settings
Security Settings
Advanced Audit Policy Configuration
System Audit Policies
Logon/Logoff
Audit Other Logon/Logoff Events
checkbox success/failure

Or via Command line (Admin):
auditpol /get /subcategory:"Other Logon/Logoff Events"
auditpol /set /subcategory:"Other Logon/Logoff Events" /success:enable /failure:enable
auditpol /get /subcategory:"Other Logon/Logoff Events"

TaskScheduler
Create a task
Trigger=On an Event, Log=Security, Source=MS Windows Security Auditing, EventID=4802.
Optionally, Trigger on schedule after 11pm each day when idle.
Action - shutdown /s /f
Optionally - write your own shutdown script which will close all open apps.
Previous post Next post
Up