This collection of PowerShell scripts provide a way to download, install, uninstall, or reset Ubuntu 20.04 in WSL.
By default, PowerShell's execution policy is set to Restricted and script execution is not allowed. To be able to execute PowerShell scripts, the execution policy must be changed to RemoteSigned or Unrestricted.
Execute the following command in a PowerShell terminal with Administrator permissions:
Set-ExecutionPolicy RemoteSigned
or
Set-ExecutionPolicy Unrestricted
Some ways to launch PowerShell with Administrator privileges are:
-
Press
Win
+X
, the selectWindows PowerShell (Admin)
then perform acd
command to the desired directory. -
Short way is to open a folder in Windows Explorer then press
ALT
F
S
A
. Long way:File
>Open PowerShell Submenu
(Click on the right arrow>
) >Open Windows PowerShell as administrator
.\0_enable_wsl.ps1
.\1_download_ubuntu.ps1
This script will download an ubuntu-2004.zip
file.
.\2_install_ubuntu.ps1
This script extracts the contents of the ubuntu-2004.zip
and calls
.\ubuntu\ubuntu2004.exe
to start the installation process.
.\3_reset_ubuntu.ps1
This script will reset (uninstall and reinstall) the Ubuntu installation.
.\4_uninstall_ubuntu.ps1
These scripts are provided as-is and without warranties. The author holds no responsibility over the usage and results arising from the use of these scripts. Use at your own risk.