X11 forwarding requires an instance of the X server (with its own display number) for each concurrent user. On Remote Desktop Services hosts where multiple users land, this means starting a per-session XMing instance before launching PuTTY.
The bundled launch_xming.ps1 handles the per-user XMing startup. It picks a free X display, sets $env:DISPLAY, launches Xming.exe, then opens putty.exe against the requested host with -X to forward X11.
Save launch_xming.ps1 to C:\Tools\ (or any other directory accessible to the launching process) on each host that runs the launcher.
What the script does:
- Reads
param($machine, $username, $password)passed by the launcher. - Greets with a banner.
- Reads
netstat -anto find the lowest-numbered free TCP port in the X11 range (6000+) — that becomes the next free X display. - Sets
$env:DISPLAY = ":<n>". - Starts
C:\Program Files (x86)\Xming\Xming.exe :<n> -multiwindow -clipboard. - Starts
C:\tools\putty.exe -X -ssh $machine -l $username -pw $password.
Adjust the hard-coded paths at the bottom of the script if the XMing or PuTTY installs are elsewhere.
The built-in Unix Account (SSH) template works directly. Consider duplicating it and naming the copy something like Unix Account (SSH) – X11 Xming so the launcher only attaches to secrets where X11 forwarding is wanted.
| Launcher field | Value |
|---|---|
| Launcher Name | XMING X11 Fwd SSH Non-Proxied |
| Launcher Type | Process |
| Active | Yes |
| Wrap custom parameters with quotation marks | Yes |
| Record Multiple Windows | Yes |
| Record Additional Processes | xming.exe |
| Process Name | powershell.exe |
| Process Arguments | -file C:\tools\launch_xming.ps1 $MACHINE $USERNAME $PASSWORD |
| Run Process As Secret Credentials | No |
| Load User Profile | No |
| Use Operating System Shell | No |
Adjust the script path in Process Arguments if launch_xming.ps1 lives somewhere other than C:\Tools.
| Template field | Map to |
|---|---|
| Launcher Type to use | XMING X11 Fwd SSH Non-Proxied |
| Machine | Machine |
| Password | Password |
| Username | Username |
Test on an RDS host with two users connected simultaneously to confirm each user gets their own X display number.