We are creating a deployment for WSL/Ubuntu 20.04. This works flawlessly for virgin machines.
However, we have a population of machines which have Ubuntu 16.04 which we want to update. We're not in the least concerned about any user-level data, as WSL is used simply as a tool for loading structural models.
Here's the CMD we run on the target machines:
wsl --terminate Ubuntu-16.04
wsl --unregister Ubuntu-16.04
wsl --unregister Ubuntu-20.04
powershell Add-AppxPackage -Path '[path_to_AppX]\Ubuntu_2004.2021.825.0_x64.appx'
ubuntu --install --root
After installing, that last command causes the distro to prompt for the creation of a default UNIX account. It does NOT do this on virgin machines. It simply exits.