'Why does VS Code remote WSL launch mstsc.exe (Remote Desktop Connection)?

I've noticed whenever I launch a VS Code WSL session I get an mstsc.exe (Remote Desktop Client) process running. I don't think this is a problem in itself however mstsc is causing some flickering and poor overall system performance even though CPU and memory usage isn't excessive.

How is mstsc.exe related to VS Code Remote WSL? Is it needed if I'm not running any graphical desktop applications in WSL? Can th remote session run without mstsc?

I had never noticed this prior to upgrading to Windows 11 in case that's significant.



Solution 1:[1]

I use this app https://superuser.com/a/1042066/3489 to identify mstsc.exe as the cause of desktop / input focus flickering.

Event Viewer > Windows Logs > Security > Microsoft Windows security auditing confirmed it was mstsc.exe being launched by Creator Process Name: C:\Windows\System32\lxss\wslhost.exe

And finally wsl --shutdown made it stop.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Todd Smith