On a Schedule
Run scripts without being there, and make backups that work.
Updated
Scheduling
- Scheduled Tasks (Journeyman): A scheduled task is Windows' alarm clock for programs, a trigger that says when and an action that says what to run, built with New-ScheduledTaskTrigger and New-ScheduledTaskAction, handed to Task Scheduler with Register-ScheduledTask, and checked with Get-ScheduledTask.
- Scripts That Run Without You (Freelancer): A script run by a scheduled task has nobody to answer its questions and doesn't start in its own folder, so it takes parameters instead of asking, builds its paths from $PSScriptRoot, leaves a dated log and a Start-Transcript recording, ends with an honest exit code, and runs as the account the task names.
Backups
- Backups That Work: `robocopy` (Journeyman): robocopy, the copying program that comes with Windows, copies a folder and after that only what changed, mirrors it with /MIR (which deletes from the backup too), rehearses with /L, and ends with an exit code where anything below 8 means success.
Exercise: Back Up While You Sleep
- Exercise: Back Up While You Sleep (Journeyman): Turn a backup script that only works at the keyboard into one a scheduled task can run every evening at 6 PM, with no questions, full paths, a dated log and a transcript, a robocopy mirror that never mirrors an empty folder and can rehearse, and an honest exit code, then build the task that runs it, while a Pester check runs your script the way the task would.