Pcornel
Automation · PowerShell Automation

Scheduled Jobs

Cheat sheet · https://pcornel.dk/topic.php?topic=5247

Back to the Topic

Answer

PowerShell scheduled jobs (Register-ScheduledJob) or scheduled tasks (Register-ScheduledTask) run scripts on a schedule; use a service account or gMSA and log output to a file.

Remember

  • Use scheduled tasks for PowerShell scripts.
  • Run as a service account or gMSA.
  • Log output to a file.

First checks

  • Get-ScheduledJob — PS scheduled jobs (5.1)
  • Get-ScheduledTask -TaskPath \Custom\ — Task Scheduler tasks
  • Get-ScheduledTaskInfo -TaskName <n> — last result

Verify in this order

schedule → task → script → result code

Where it usually breaks

Script/input → command/module binding → local/remoting session → request accepted → command result → target object read-back → effective runtime state → workload.

Scheduled Jobs · PowerShell operational reference

BoundaryScheduled Jobs reference
Runtime identityPowerShell edition/version + command/module source
Persistent intentScript/module/config prerequisites under source control
VerificationRead-only discovery → execution evidence → independent target read-back
Output contractStructured objects/streams before formatting
Failure boundarySeparate engine/binding from transport/API/native and target-state failures

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5247

Confirmation

Confirm action

Continue?