What I have done is create a batch file in Windows, with the following contents:
wsl --user myusername --distribution Ubuntu --exec sudo service postgresql start
Then created a task in the “Task Scheduler” in Windows that starts when I log on to Windows. This ensures that when WSL is used, the postgres service is already started. As can be seen above this is for Ubuntu, but if you can manually start your service in your distribution in the console, this can be automated in the same manner as above.
Here the prerequisites for the above to work:
sudo visudo
Add the following to the end of the file:
%sudo ALL=(ALL) NOPASSWD: /usr/sbin/service postgresql *
I have documented my installation steps for Elixir/Erlang in Ubuntu on WSL here, in case you are interested: