- You need to install and configure WSL2 properly before proceed. Assume the distro name is
Ubuntu
. - Create a task that runs on startup. Replace and with the owner of the WSL2 distro. (Note that WSL2 distro is per-user based, not system-wide.)
schtasks /create /tn "WSLKeepAlive" /tr "wsl -d Ubuntu sleep infinity" /sc ONSTART /ru <USERNAME> /rp <PASSWORD>
- Run this task now to start WSL2:
schtasks /run /tn "WSLKeepAlive"