A deterministic, operator‑grade PowerShell module for safely updating Visual Studio Code on Windows.
Provides full logging, cleanup routines, installer caching, and a multi‑lane watchdog to detect and recover from installer stalls.
The built‑in Visual Studio Code updater frequently fails on long‑lived Windows systems due to:
- stale bootstrapper processes
- orphaned InnoSetup workers
- partial or corrupted installs
- silent failures with no diagnostics
- reissued builds that reuse the same version number
- inconsistent behavior across Windows update states
These issues cause VS Code to hang, refuse to launch, or leave behind incomplete installations.
VSCode-Updater replaces the non‑deterministic built‑in updater with a reproducible, watchdog‑driven update pipeline designed for operators, automation, and audit transparency.
- Fully automated VS Code update workflow
- Deterministic logging with timestamped, single‑line entries
- Cleanup routines for bootstrapper, helpers, and Inno workers
- Installer acquisition and caching
- Detached installer execution
- Multi‑lane watchdog monitoring:
- Filesystem stall detection
- CPU/Disk idle stall detection
- CPU/Disk active stall detection
- Automatic stall recovery and retry logic
- Explicit, automation‑safe return codes
- Pester test suite for critical components
- Single public API (
Update-VSCode), implemented directly in the module and supported by private helper functions.
- PowerShell 7.6 or later
- Windows 10 or Windows 11
You can use the module in two ways:
Place the module under a standard module directory, for example:
$HOME\Documents\PowerShell\Modules\VSCode-Updater\
PowerShell will auto‑load it when you call:
No explicit Import-Module is required in this case.
If the module lives in a custom path (for example, under a project tree or sync folder), you must import it before calling Update-VSCode:
Import-Module "C:\Path\To\VSCode-Updater\VSCode-Updater.psd1" -Force
Update-VSCodeThe function cannot be executed until the module is imported (either auto‑loaded from a module path or imported explicitly).
Update-VSCodeThis triggers the full deterministic update pipeline:
- Cleanup of stale installer processes
- Optional skip/force download modes
- Installer download and caching
- Detached installer launch
- Watchdog monitoring of progress
- Stall detection and recovery
- Final cleanup and exit code emission
No parameters are required for a standard update run.
However, parameters are available for advanced control (see below).
Update-VSCode exposes optional parameters for operator and automation scenarios. (Adjust this list to match your actual parameter set.)
Update-VSCode [
-SkipUpdate
-SkipDownload
-ForceDownload
-RetryCount <int>
-IdleTimeout <int>
]-
-SkipUpdateBypasses the update process entirely. Useful when you want to run cleanup routines or validate environment behavior without performing an update. -
-SkipDownloadUses an already‑cached installer. No network request is made. If no cached installer exists, return code 12 is emitted. -
-ForceDownloadAlways downloads a fresh installer, ignoring any cached copy. Overrides -SkipDownload if both are provided. -
-RetryCount <int>(default: 3) Number of retry attempts the watchdog will perform if a stall is detected. -
-IdleTimeout <int>(default: 600 seconds) Maximum allowed stall duration before the watchdog triggers a retry or failure. Applies to filesystem, idle, and active stall detection lanes.
All parameters are optional.
If you call Update-VSCode with no arguments, the module runs with its default, deterministic behavior.
Get-Command -Module VSCode-UpdaterExpected:
Function Update-VSCode
A typical successful run:
[2025-03-27 09:14:22] INFO Detected installed version: 1.89.1
[2025-03-27 09:14:23] INFO Latest version available: 1.90.0
[2025-03-27 09:14:24] INFO Downloaded installer to: C:\Temp\vscode.exe
[2025-03-27 09:14:31] INFO Update completed successfully
All output is automation‑safe and audit‑transparent.
VSCode-Updater uses a four‑lane deterministic pipeline:
-
Discovery Lane
- Detect installed version
- Query latest available version
- Validate cached installer
-
Acquisition Lane
- Download installer if required
- Cache installer for reuse
- Validate file integrity
-
Execution Lane
- Launch installer in detached mode
- Track installer PID
- Monitor filesystem and resource activity
-
Watchdog Lane
- Filesystem stall detection
- CPU/Disk idle stall detection
- CPU/Disk active stall detection
- Automatic retries
- Deterministic exit codes
The watchdog monitors the installer for progress and detects stalls using three independent signals.
| Stall Type | Description |
|---|---|
| Filesystem Stall | No writes to the VS Code install directory for the full IdleTimeout |
| Idle Stall | CPU=0 and Disk=0 for the full IdleTimeout |
| Active Stall | CPU/Disk metrics frozen (no change) for the full IdleTimeout |
Each stall type produces a distinct return code and log entry.
| Code | Meaning |
|---|---|
| 0 | Success |
| 10 | Download failure |
| 12 | Cached installer missing |
| 13 | Installer start failure |
| 14 | Installer stalled after all retries |
| 20 | SkipUpdate flag used |
| 30 | Filesystem stall detected |
| 31 | CPU/Disk idle stall detected |
| 32 | CPU/Disk active stall detected |
| 99 | Unexpected watchdog state |
These codes are deterministic and safe for automation, monitoring, and CI/CD pipelines.
- Single‑line, timestamped entries
- No banners or multi‑line blocks
- All watchdog transitions logged
- All exit paths emit a final banner with exit code
- Fully audit‑transparent
| Component | Supported |
|---|---|
| Windows 10 | ✔ |
| Windows 11 | ✔ |
| VS Code Stable | ✔ |
| VS Code Insiders | ⚠ Not supported (Stable installer will overwrite Insiders) |
| PowerShell 7.6+ | ✔ |
| ARM64 | ⚠ Untested (expected to work with ARM64 user installer) |
This module is stable and feature‑complete. Tests and documentation continue to expand as it moves toward broader deployment.
Invoke-Pester -Path TestsThis project is licensed under the MIT License. See the LICENSE file for details.
These tools are part of the Linktech Engineering operator‑grade ecosystem:
- NMS_Tools — Network Monitoring Suite tools for certificate checks, HTML checks, interface checks, and more.
- rust-logger — Structured, deterministic logging library for Rust applications.
- licensegen — Deterministic license generator with reproducible output and SPDX‑compliant metadata.
- BotScanner-Community — Community edition of the BotScanner host and flow inspection framework.