A couple of years ago I built a script to download/install everything you need for an RDP-accessible Kali desktop on WSL, and does not require systemd: https://github.com/DesktopECHO/Kali-xRDP
PowerShell -executionpolicy bypass -command "wget https://github.com/DesktopECHO/Kali-xRDP/raw/main/Kali-xRDP.cmd -UseBasicParsing -OutFile Kali-xRDP.cmd ; .\Kali-xRDP.cmd"
You will be asked a few questions. The installer script determines the current Windows DPI scaling of your system but you may set your own if preferred:
[Kali xRDP Installer 20210602]
Hit Enter to use your current display scaling in Windows
or set the desired value (1.0 to 3.0 in .25 increments) [1.5]: 1.25
Port number for xRDP traffic or hit Enter for default [3399]:
Port number for SSHd traffic or hit Enter for default [3322]:
[Not recommended!] Type X to eXclude from Windows Defender:
The script will download the LxRunOffline distro manager to bootstrap the installation. Install times will vary depending on system performance and the presence of antivirus software. A fast system with broadband Internet can complete the install in under 10 minutes and most machines will complete within 20 minutes. Expect it to take 30+ minutes if Windows Defender is running. If you want to track progress logs are located in %TEMP%\Kali-xRDP.
[22:18:12] Prepare Distro (~1m00s)
[22:19:08] Install xRDP and Kali-Linux-Core packages (~3m00s)
[22:22:53] Kali-Desktop-XFCE (~5m00s)
[22:30:39] Additional Components (~1m00s)
At the end of the script you will be prompted to create a non-root user which will automatically be added to sudo'ers.
Create a NEW user in Kali for xRDP GUI login. Enter username: kaliuser
Enter password for kaliuser: **********
Open Windows Firewall Ports for xRDP, SSH, mDNS...
Building RDP Connection file, Init system...
Building Scheduled Task...
SUCCESS: The scheduled task "kali-linux" has successfully been created.
Start: Thu 02/25/2021 @ 22:17
End: Thu 02/25/2021 @ 22:31
Packages: 1154
- xRDP Server listening on port 3399 and SSHd on port 3322.
- Link for GUI session has been placed on your desktop.
- (Re)launch init from the Task Scheduler or by running the following command:
schtasks.exe /run /tn kali-linux
Installaion of xRDP GUI on "kali-linux" complete, graphical login will start in a few seconds...
A fullscreen remote desktop session will launch Kali using your stored credentials.
Convert to WSL2 instance:
Terminate the instance: wslconfig /t kali-linux
Convert the instance to WSL2: wsl --set-version kali-linux 2
Restart the Instance: schtasks /run /tn kali-linux