How to Configure Windows Sandbox Printer Redirection via XML in Windows 11

Windows Sandbox provides a disposable, hypervisor-isolated desktop environment on Windows 11. By default, Windows Sandbox isolates all peripheral hardware—including local USB printers, network print queues, and scanning devices—to prevent untrusted software from accessing physical peripherals. However, when evaluating accounting software, testing reporting engines, or validating document rendering workflows, developers can enable printer redirection through XML configuration files or utilize virtual PDF print drivers.

Understanding Windows Sandbox Peripheral Redirection

Windows Sandbox runs atop the Remote Desktop Protocol (RDP) virtual architecture. Peripheral redirection operates through coordinated configuration channels:

  • <PrinterRedirection>Enable</PrinterRedirection>: Directs the sandbox hypervisor to enumerate host physical and network printers, mapping them into the guest desktop session using Remote Desktop Easy Print.
  • <PrinterRedirection>Disable</PrinterRedirection>: Default posture. Ensures complete device isolation, blocking the sandbox from initiating physical print jobs or probing printer network queues.
  • Virtual Print Queues: Built-in virtual drivers—such as Microsoft Print to PDF and Microsoft XPS Document Writer—function inside the sandbox independently of hardware redirection.

Authoring the Printer-Enabled Sandbox XML (.wsb)

Create a customized configuration file that enables printer redirection and maps a host documents directory:

  1. Open an administrative PowerShell terminal on Windows 11.
  2. Create a designated host directory for generated print jobs and test files:
    New-Item -Path "C:\SandboxPrints" -ItemType Directory -Force | Out-Null
  3. Author the .wsb XML configuration file:
    $wsbContent = @"
    
      Enable
      Enable
      Default
      
        
          C:SandboxPrints
          C:UsersWDAGUtilityAccountDesktopPrints
          false
        
      
    
    "@
    
    $wsbContent | Out-File -FilePath "$env:USERPROFILE\Desktop\PrinterSandbox.wsb" -Encoding utf8

Verifying Printer Queues Inside the Sandbox

Confirm that host printers are redirected into the guest environment:

  1. Double-click PrinterSandbox.wsb to launch Windows Sandbox.
  2. Inside the sandbox, open the Start menu, type Printers & scanners, and select the system settings page.
  3. Review the installed printers list:
    • Notice host physical printers marked with (redirected 1) appended to their names.
    • Confirm the presence of Microsoft Print to PDF.
  4. Open Notepad inside the sandbox, enter test text, press Ctrl + P, and select your redirected printer or PDF printer to generate a test print.

Troubleshooting Common Printer Redirection Failures

If host printers fail to appear inside the sandbox:

  • Group Policy Restrictions: Ensure the host policy Do not allow client printer redirection (under Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services) is set to Not Configured or Disabled.
  • Remote Desktop Easy Print Driver: Confirm that the host Windows 11 system has the Remote Desktop Easy Print driver installed and running.
  • Print Spooler Service: Verify that the Spooler service is running on the host system:
    Get-Service -Name Spooler

Automating Output Archival via Mapped Folders

By mapping a writable host folder (e.g., C:SandboxPrints), developers can instruct applications inside the sandbox to print directly to PDF and save output files to the mapped desktop folder, archiving print artifacts on the host Windows machine before the sandbox terminates.

Get the best tech tips delivered straight to your inbox.

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