# Project Scripts

The scripts every project has, calling other programs from PowerShell, and keeping secrets out of scripts.

Updated: November 10, 2026

## [In a Project](https://www.ask-codey.com/courses/powershell-in-depth/topics/powershell-in-a-project)

1. [The Scripts Every Project Has](https://www.ask-codey.com/lessons/powershell-project-scripts) (Journeyman): A build.ps1 gathers a project's chores in one script, each task a function that -Task picks through a ValidateSet parameter and a switch; Get-Command checks that the tools the project needs are installed, and $ErrorActionPreference = 'Stop' with throw stops the script at the first problem.
2. [Calling Other Programs](https://www.ask-codey.com/lessons/powershell-native-commands) (Journeyman): Programs such as git, dotnet and npm run from PowerShell by name, hand back their output as lines of text, take arguments from variables and arrays, and run by a path with & in front; a failing program doesn't stop a script by itself, so check $LASTEXITCODE after it, or set $PSNativeCommandUseErrorActionPreference to $true.
3. [Secrets Out of Scripts](https://www.ask-codey.com/lessons/powershell-secrets) (Journeyman): A password or token written into a script travels wherever the script goes, so a script names the secret it needs and reads it from an environment variable, asks for it with Get-Credential, or fetches it from a SecretManagement vault, and stops with a clear message when it isn't there.

## [Exercise: A Project's Build Script](https://www.ask-codey.com/courses/powershell-in-depth/topics/exercise-powershell-a-projects-build-script)

1. [Exercise: A Project's Build Script](https://www.ask-codey.com/lessons/exercise-powershell-a-projects-build-script) (Journeyman): Finish the Maple Street Bikes website's build.ps1 with check, test, package and publish tasks that find their tools with Get-Command, stop when a program's exit code says it failed, and read the deploy token from the environment, and let a Pester check run each task the way a build server would.

Source: https://www.ask-codey.com/courses/powershell-in-depth/chapters/powershell-project-scripts
