How to Configure Windows Sandbox Local Prometheus Node Exporter via XML in Windows 11

Observability engineers and DevOps administrators frequently evaluate monitoring metric collectors, scrape targets, and alert rules before rolling updates across enterprise infrastructure. Installing Prometheus exporters directly on your primary workstation can clutter host system services and leave lingering registry entries. In Windows 11, Windows Sandbox provides a pristine, isolated testing platform. By authoring custom Windows Sandbox XML (.wsb) configuration files, you can deploy an automated Prometheus Windows Exporter instance in seconds.

Sandbox Architecture for Observability Testing

Windows Sandbox provides a disposable, hypervisor-isolated guest environment that resets completely upon termination. To provision an automated exporter instance, the architecture requires:

  • A mapped host folder: A directory containing the windows_exporter.exe binary and collector configuration flags.
  • A WSB configuration file: An XML blueprint that mounts the mapped directory and initiates the monitoring agent automatically via LogonCommand.

Authoring the Windows Sandbox WSB Blueprint

Create a working directory on your host machine, such as C:\SandboxExporter. Place the latest windows_exporter.exe binary into this folder, then create RunExporter.wsb with the following XML code:

<Configuration>
  <VGpu>Default</VGpu>
  <Networking>Default</Networking>
  <MappedFolders>
    <MappedFolder>
      <HostFolder>C:\SandboxExporter</HostFolder>
      <SandboxFolder>C:\ExporterFiles</SandboxFolder>
      <ReadOnly>false</ReadOnly>
    </MappedFolder>
  </MappedFolders>
  <LogonCommand>
    <Command>powershell.exe -ExecutionPolicy Bypass -NoExit -File C:\ExporterFiles\Start-Exporter.ps1</Command>
  </LogonCommand>
</Configuration>

Authoring the Automated Exporter Startup Script

Inside the mapped host folder (C:\SandboxExporter), create the PowerShell initialization script named Start-Exporter.ps1:

Write-Host "===============================================" -ForegroundColor Cyan
Write-Host " Starting Prometheus Windows Exporter Agent... " -ForegroundColor Green
Write-Host " Metrics Endpoint: http://127.0.0.1:9182/metrics " -ForegroundColor Yellow
Write-Host "===============================================" -ForegroundColor Cyan

# Define active collectors for testing
$Collectors = "cpu,cs,logical_disk,net,os,system,memory"

# Launch exporter process in interactive console
& "C:\ExporterFiles\windows_exporter.exe" --collectors.enabled $Collectors --telemetry.addr ":9182"

Validating Metrics Scrapes in Windows Sandbox

Launch the environment by double-clicking RunExporter.wsb. The Windows 11 sandbox boots, mounts the binary, and immediately triggers the PowerShell console.

The exporter agent begins listening on port 9182. Open Microsoft Edge inside the sandbox and navigate to http://127.0.0.1:9182/metrics. You will observe rich Prometheus telemetry, including windows_cpu_time_total, windows_memory_available_bytes, and disk queue metrics.

You can run local scrape test scripts, validate scrape timing, or benchmark custom exporter flags under controlled stress conditions. When testing is complete, simply close the sandbox window. The entire virtual machine, exporter process, and all temporary metrics state vanish completely without affecting host stability.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.