Enabling Required Features
Create a PowerShell script file named enable-wsl-features.ps1 and paste the following commands. Execute it with administrator privileges, then restart your system.
# Set execution policy for this session
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
# Navigate to script directory
$scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
Push-Location $scriptPath
# Find and install Hyper-V packages
Get-ChildItem "$env:SystemRoot\servicing\Packages\*Hyper-V*.mum" | ForEach-Object {
$packageName = $_.Name
Write-Host "Installing package: $packageName"
DISM /Online /NoRestart /Add-Package:"$env:SystemRoot\servicing\Packages\$packageName"
}
# Enable required Windows features
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All -NoRestart -All
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -NoRestart -All
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux -NoRestart -All
# Clean up
Get-ChildItem "hyper-v.txt" -ErrorAction SilentlyContinue | Remove-Item
Pop-Location
Updating WSL
The official documentation provides an update method, but it can be slow.
For faster installation, manually download the latest release from:
https://github.com/microsoft/WSL/releases
After downloading, run the installer package normally.
To verify your WSL version:
wsl --version
If this displays version information, your WSL installation was successful.
Installing Linux Distributions
Distribution Selection
To view available Linux distributions, use:
wsl --list --online
This will show all available distributions you can install:
PS C:\Users\32956> wsl --list --online
The following are valid Linux distributions that can be installed.
Use 'wsl.exe --install <Distro>' to install.
NAME FRIENDLY NAME
Debian Debian GNU/Linux
Ubuntu Ubuntu
Ubuntu-22.04 Ubuntu 22.04 LTS
Ubuntu-24.04 Ubuntu 24.04 LTS
kali-linux Kali Linux Rolling
openSUSE-Tumbleweed openSUSE Tumbleweed
OracleLinux_8_7 Oracle Linux 8.7
Installation Methods
Using winget package manager:
# Search for available distributions
winget search wsl
# Install a specific distribution (example for Ubuntu 22.04)
winget install Canonical.Ubuntu.2204
Alternative, use WSL command directly:
# Install a specific distribution
wsl --install -d Ubuntu-22.04
Troubleshooting
WSL Update Error (403 Forbidden)
If you encounter:
PS C:\Users\32956> wsl --install
Forbidden (403).
This typically occurs when system proxies are enabled. Temporarily disable your proxy settings or configure WSL to bypass proxies for the update process.