This Powershell script lets you map ports from your WSL2 instance to the same ports on your Windows host machine. It's useful when working with development tools that must comunicate between the host and the WSL2, such an Android emulator running on Windows and a development server running on WSL2.
- Start your WSL2 instance
- Write into the
$ports
array the ports you want to map. - With the WSL2 instance running, run the powersell script on Windows as administrator.