Renaming a WSL Distro

I Recently had the need to change the name of one of the Distro’s on my WSL Environment, this is the process I followed to rename it.

  1. Stop all instances of WSL

    wsl --shutdown
    
  2. Open Registry Editor and go to

    HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss
    
  3. Find the distro you want to rename, look for the key

    DistributionName
    
  4. Change the key DistributionName to the desired value

  5. Verify by running the following

    wsl -l -v
    

    This will list the running Distros

Upgrading the WSL Distro

This process is how I went through upgrading my WSL Distro. This process completed an in place up grade of the system. I could have just re downloaded the new distro as I hadn’t save much content to the image. But as I plan on doing so this was a good chance to go through the process.

Checking the current version

lsb_release -a

Returns the following,

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 19.10
Release:        19.10
Codename:       eoan

Next I needed to make sure that I was on the latest version of the current release.

sudo apt update
sudo apt list --upgradable
sudo apt upgrade

Next I cleaned up any packages that were no longer needed

sudo apt --purge autoremove

Now to update the core manager package

sudo apt install update-manager-core

Finally to start the upgrade

sudo do-release-upgrade

At this point i left the system to do it’s thing and complete the upgrade. This could take some time as it downloads all of the packages that it needs.

During the install you are asked a couple of times to authorize and continue. When this is done the system will restart.

At this point you just need to restart the WSL terminal session and check the version.

lsb_release -a

and the output returned is.

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:        20.04
Codename:       focal

Updating Azure Scripting Tools

I use the various scripting tools for azure on a daily bases, so because of this I put together this little script that I run to update the toolsets.
It currently does the azureCLI and az Powershell Modules, only simple but it does what I need.

You will need to run the script under an Administrator Prompt.

# Update the AzureCLI system on Windows
Write-Host "Installing/Updating the AzureCLI Components"
Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'

# Update the Powershell az Modules
Write-Host "Installing/Updating the Azure PowerShell Modules"
Install-Module -Name Az -AllowClobber -Force

# Gather the version information
# Get-InstalledModule -Name Az -AllVersions | select-object Name,Version

Write-Host "Updating the Azure Components Complete"