-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall-wsl2.ps1
More file actions
executable file
·24 lines (19 loc) · 900 Bytes
/
install-wsl2.ps1
File metadata and controls
executable file
·24 lines (19 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Set-ExecutionPolicy Unrestricted
Write-Host "DO: Installing WSL2"
wsl --set-default-version 2
$MyLink = "https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi"
$AppPath = echo $(Get-Location) | Select-String "C:"
$AppPath = $AppPath -replace "`n|`r"
$AppPath = $AppPath + "\wsl2-linux-kernel-installer.msi"
$condition = $(Test-Path -Path $(echo $AppPath))
if ( ! $condition )
{
Write-Host "WSL2 launching update file download"
Invoke-WebRequest -Uri $MyLink -OutFile wsl2-linux-kernel-installer.msi
}
Write-Host "WSL2 launching update install"
msiexec /qn /i $(echo $AppPath)
#Add-AppxPackage -Path $(echo $AppPath) -ForceUpdateFromAnyVersion -ForceTargetApplicationShutdown
wsl --unregister "Ubuntu"
Write-Host "Wait until Ubuntu is fully installed in WSL2 and ´don't forget to set up your local user name/password"
wsl --install -d "Ubuntu"