Windows 11 WSL Error – Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS

I was installing Ubuntu in Windows 11 using WSL. I was getting the error below:

“Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS.”

This is how I fixed it:

1. Reset the Bios and re-enable the Virtual Machine Platform In BIOS
2. Run the following commands:

DISM /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V

bcdedit /set hypervisorlaunchtype auto