3 Windows development-box provisioning scripts.
5 `setup-windows.bat` takes a fresh Windows install to a working C++ / native
6 development environment: editors and shells, Python, the Visual Studio 2022
7 toolchain (including the Clang and Windows XP targeting toolsets), the Windows
8 Driver Kit, and a handful of analysis tools (Sysinternals, OpenCppCoverage,
9 BinSkim, the Windows Performance Toolkit). It also sets the box up to be driven
10 remotely: OpenSSH Server plus an rsync build for Windows, which is what makes a
11 throwaway VM reachable from a Linux host.
17 | `setup-windows.bat` | Entry point. Runs the non-elevated, per-user half (winget installs, user `PATH` edits, global git config), then launches the elevated half and prints its log. |
18 | `setup-windows-with-uac.ps1` | The elevated half, started via UAC by the batch file. Enables `ssh-agent`, installs and starts OpenSSH Server, installs `rsync.exe` to the machine `PATH`, then installs Visual Studio 2022 Community with the required components, the WDK, and the Windows Performance Toolkit. Can also be run directly from an Administrator prompt. |
22 1. **Edit `setup-windows.bat` first.** The global git identity near the middle of
23 the file is placeholder text:
26 git config --global user.name "PLACEHOLDER_NAME"
27 git config --global user.email "PLACEHOLDER_EMAIL"
30 Substitute your own name and email, or comment both lines out to keep your
31 identity per-repository.
33 2. Run it from a normal (non-elevated) prompt:
39 It will raise a single UAC prompt for the elevated half. Accept it — declining
40 leaves Visual Studio and the WDK uninstalled, and the script says so.
42 3. Restart your shell afterwards so the updated user `PATH` is picked up, and
43 reboot if a step reported that a restart was required.
47 - The elevated half writes a transcript to `setup-windows-uac.log` next to the
48 script; the batch file prints it when the elevated window closes. The log is
49 gitignored, as it contains local paths.
50 - Both halves are idempotent — re-running skips anything already installed.
51 BinSkim in particular checks NuGet for the newest stable version *before*
52 downloading: the package is a self-contained .NET build well over 100 MB, and
53 re-provisioning an up-to-date box should not pay for it. The installed version
54 is tracked in `nupkg-version.txt` beside the tool.
55 - **Remote access.** OpenSSH Server is installed from the Windows on-demand
56 capability (10/1809+), set to start automatically, and given an inbound TCP 22
57 firewall rule on *all* profiles — a VM's host-only or bridged adapter is
58 routinely classified Public, which is the usual reason a running `sshd` is
59 unreachable. Windows ships no `rsync`, so a build of it
60 ([nuket/rsync-windows](https://github.com/nuket/rsync-windows)) is installed to
61 `C:\Tools\rsync` and added to the **machine** `PATH`. That last detail matters:
62 the remote end of an `rsync` runs non-interactively, with no login shell, and
63 Win32-OpenSSH builds that environment from the registry `PATH` rather than from
64 a profile. Key auth needs `~/.ssh/authorized_keys` ACL'd to just you and
65 `SYSTEM`; accounts in the Administrators group use
66 `C:\ProgramData\ssh\administrators_authorized_keys` instead.
67 - Visual Studio is installed in three labelled passes (base workload, Clang/LLVM,
68 XP toolset) so a failure identifies which component group is responsible.
69 - The scripts were extracted from a native Windows project, so the component
70 selection is tuned for that: Spectre-mitigated runtimes, the v141/XP toolset,
71 and driver-kit headers. Trim the component lists in the `.ps1` if you don't
72 need them — each group is a plain array near the top.