Script Windows Registry changes for deployment using reg.exe (reg add/query/export/import) instead of the PowerShell registry provider
domain: learn.microsoft.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Use `reg query <keypath>` to inspect existing subkeys/values before making changes, targeting keys under roots like HKLM or HKCU.
Use `reg add <keypath> /v <valuename> /t <type> /d <data> /f` to create or overwrite a value non-interactively; the /f flag suppresses the overwrite-confirmation prompt.
Use `reg export <keypath> <file.reg>` to snapshot a key (and its subkeys/values) to a .reg file before a scripted change, so it can be restored if needed.
Use `reg import <file.reg>` to apply a previously exported (or hand-authored) .reg file's contents back into the registry.
For remote-machine operations, note that reg.exe supports only a subset of operations and parameters against remote computers compared to local operations, so validate remote scenarios separately from local ones.
Known gotchas
reg add against a key that already contains the target value silently overwrites it once /f is passed, with no further confirmation, so scripts needing conditional changes should query first.
reg.exe run from a 32-bit process on 64-bit Windows can be redirected to the WOW6432Node view of HKLM\Software; scripts should be explicit about which architecture's key they intend to touch rather than assuming a plain path always hits the 64-bit view.
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?