# Scripts That Run Without You

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.

![Cheat sheet for the lesson Scripts That Run Without You: 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…](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/f48de92bc23140d4b41f41bc9ffd9dbf.webp)

- Category: PowerShell
- Level: Freelancer
- Tags: exit-code, log-file, operating-system, powershell, principle-of-least-privilege, psscriptroot, start-transcript, system-account
- Updated: November 10, 2026

Source: https://www.ask-codey.com/cheat-sheets/powershell-unattended-scripts-cheat-sheet
