scripts/prereqs-windows.ps1¶
Platforms: Windows.
Purpose¶
prereqs-windows.ps1 installs the prerequisites setup-windows.ps1
needs via winget: PowerShell 7+, Python 3.12+, Git, the Azure CLI, the .NET
SDK, the Microsoft Agent 365 DevTools CLI (a365), and — unless skipped —
Visual Studio Build Tools with the C++ workload (needed to compile native
Python packages such as cryptography/cffi). It is safe to re-run; each
step detects an existing install and skips ahead.
Requirements¶
- Can run from Windows PowerShell 5.1 — unlike
setup-windows.ps1, this script does not requirepwshfirst; it only needs#Requires -Version 5.1, so it can bootstrappwshitself from the pre-installed shell. winget(Windows Package Manager) must already be available. It ships with Windows 11 and Windows 10 (1809+); if missing, the script prints thehttps://aka.ms/getwingetinstall link and exits.- A working internet connection for
wingetdownloads.
Usage¶
# Install everything
.\scripts\prereqs-windows.ps1
# Skip Visual Studio Build Tools (large download, ~6 GB)
.\scripts\prereqs-windows.ps1 -SkipBuildTools
# Show detailed help
.\scripts\prereqs-windows.ps1 -Help
Options¶
-SkipBuildTools— skip installing Visual Studio Build Tools with the C++ workload. Native Python package builds will fail without a C/C++ toolchain unless one is already present.-Help— print the script'sGet-Help-based documentation and exit0.
Effects¶
- Verifies
wingetis onPATH; exits1immediately if not. - PowerShell 7+ — installs or upgrades via
winget install --id Microsoft.PowerShellif the detectedpwshversion is below 7.0 or missing entirely. - Python 3.12+ — checks
pythononPATH, treating the Microsoft Store stubpython.exeunderWindowsAppsas "not installed" so it always falls through to a realwinget install --id Python.Python.3.12. - Git —
winget install --id Git.Gitif missing. - Azure CLI —
winget install --id Microsoft.AzureCLIifazis missing. - .NET SDK —
winget install --id Microsoft.DotNet.SDK.9ifdotnetis missing. - Microsoft Agent 365 DevTools CLI (
a365) — installs or updates viadotnet tool install/update --global Microsoft.Agents.A365.DevTools.Cli, adding%USERPROFILE%\.dotnet\toolstoPATHfor the rest of the run. - Visual Studio Build Tools + C++ workload (skipped by
-SkipBuildTools) — probesvswhere.exefor theMicrosoft.VisualStudio.Component.VC.Tools.x86.x64component; if absent, installs viawinget install --id Microsoft.VisualStudio.2022.BuildToolswith the VC++ workload and Windows SDK. This step alone can take 5–10 minutes and ~6 GB of disk. - Refreshes
PATHfrom the registry (Refresh-PathEnv) after each install step, then runs a final validation pass acrosspwsh,python,git,az,dotnet, anda365, printing a summary of already-present, newly-installed, and failed tools.
Exit behavior¶
0— all checked tools validate onPATHat the end, or-Helpwas requested.0— every install step succeeded but one or more tools are still not visible onPATHin the current session (common right after a fresh install); the script warns and tells the operator to open a new terminal before runningsetup-windows.ps1.1—wingetis not available, or any individualwinget/dotnet toolinstall step reports a non-zero exit code (VS Build Tools is re-checked viavswhereonce before being counted as failed, sincewingetcan report a non-zero code on an otherwise-successful Visual Studio install).
Common failures¶
winget not found— install Windows Package Manager fromhttps://aka.ms/getwinget, then re-run.- Tools "not found" right after install — close and reopen the terminal
so the refreshed machine/user
PATHis picked up, then re-run to confirm. - VS Build Tools install looks stuck — it is a large, slow
wingetinstall; give it the full 5–10 minutes before assuming failure. - Python still resolves to the Microsoft Store stub — the script already
ignores the
WindowsAppsstub and installs a real Python viawinget; ifpythonstill points at the stub afterward, checkPATHordering in a new terminal.
Related commands¶
- Script reference — Setup
setup-windows.ps1— the script this prepares the machine for.prereqs-macos.sh— the macOS counterpart.- Windows installation.