A robust PowerShell script that automates the Windows Subsystem for Linux (WSL) installation process with comprehensive error handling and system compatibility checks.
-
Download the Script
git clone https://github.com/Partha-dev01/WSL-installation-fix
Warning
Do not run random scripts off the Internet, check what this script does before running it on your machine. General explanation of this code is made available here. You can read about basic powershell commands used from this gist.
-
Run the Installation
# Navigate to that directory and run powershell as administrator. cd WSL-installation-fix .\wsl-script.ps1
- ✨ Automated WSL installation and configuration
- 🧹 Complete system cleanup of existing WSL installations
- 🛡️ Comprehensive error handling and recovery
- 🔄 Windows Store automatic repair
- 🔍 System compatibility verification
The script performs the following operations:
- Pre-Installation Checks
- System compatibility verification
- Administrator privileges validation
- Internet connectivity check
- System Cleanup
- Removes existing WSL installations
- Cleans up related system folders
- Terminates WSL processes
- Core Installation
- Downloads and installs WSL update package
- Enables required Windows features
- Configures system components
- Post-Installation
- Windows Store repair
- WSL core installation
- System restart prompt
For more detailed explanation go to detailed_wsl_code_documentation.
Note
This Script is not responsible for any broken windows installation be careful before running this. You are responsible for your own machine and data
- Backup your data before running the script
- System restart is required after installation
- WSL 2 requires virtualization support in BIOS/UEFI
- Installation time varies based on system performance
| Issue | Solution | Reference |
|---|---|---|
| Access Denied | Run PowerShell as Administrator | [2] |
| Virtualization Not Supported | Enable Virtualization in BIOS/UEFI, and ensure Virtual Machine Platform (VMP) is enabled | [1][2] |
| Download Fails | Check internet connection, try manual installation | [1][4] |
| Store Error | Run Windows Store troubleshooter | [3] |
| WSL Not Found | Verify Windows version compatibility (Windows 10 version 2004 or higher) | [1][4] |
| Kernel Update Missing | Install Linux kernel update MSI package | [4] |
| WSL 2 Update Failure | Run wsl.exe --update in an elevated terminal, or manually install the latest version |
[2][4] |
| Registry Permission Issues | Ensure proper registry permissions, may require manual adjustment | |
| Error 0x1bc | Check system locale and language settings, ensure they are set to English | [2] |
| Error 1603 | Ensure latest Windows updates are installed, and try manual installation of WSL | [3] |
-
WSL Installation Guide: https://learn.microsoft.com/en-us/windows/wsl/install
-
Troubleshooting WSL: https://learn.microsoft.com/en-gb/windows/wsl/troubleshooting
-
WSL Frequently Asked Questions: https://learn.microsoft.com/en-gb/windows/wsl/faq
-
WSL Kernel Update: https://aka.ms/wsl2kernel
-
WSL Documentation on GitHub: https://github.com/microsoft/WSL
-
WSL Issue Tracker: https://github.com/microsoft/WSL/issues
-
Manual Installation Steps for Older Versions: https://learn.microsoft.com/en-us/windows/wsl/install-manual
-
WSL Community Forum: https://forums.docker.com/c/wsl
-
WSL on Microsoft Learn: https://learn.microsoft.com/en-us/windows/wsl/about
-
WSL in the Microsoft Store: https://learn.microsoft.com/en-us/windows/wsl/store
-
https://support.overlaxed.com/knowledge-base/article/troubleshoot-common-wsl-installation-errors
-
https://learn.microsoft.com/en-us/windows/wsl/troubleshooting
Important
Need some additional testers to verify all WSL issues Any contribution, additional information or new links to this readme section is greatly appreciated.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please:
- Open an issue
Last updated: [26-01-2025]