Automatically Update WSL on Startup
Published:
Ris Adams
View profile
If you are like me, you prefer to always keep your packages as up-to-date as possible. You also like to automate things when possible to avoid repetitive admin tasks.
This script will call your default WSL instance 1, and update/upgrade all packages.
wsl -u root -e apt update
wsl -u root -e apt upgrade -y
Once this script is saved, use the Windows Task Scheduler to automate its execution. I have it set to run at login, and once per week.
I use Ubuntu, adjust as needed. You can also adjust to use a specific distro if required. I only use a single instance. ↩