diff --git a/scripts/Common/Scripts/Operations.ps1 b/scripts/Common/Scripts/Operations.ps1 index be0991cc..e8c71856 100644 --- a/scripts/Common/Scripts/Operations.ps1 +++ b/scripts/Common/Scripts/Operations.ps1 @@ -173,7 +173,7 @@ $null = New-Module { return; } - if (-not (Test-WslDistributions)) { + if (-not (Test-WslDistribution)) { if (-not (Test-Path (Get-WslDistributionDisk))) { Install-WslDistribution; } diff --git a/scripts/Windows/Scripts/WSL.ps1 b/scripts/Windows/Scripts/WSL.ps1 index 57b5125a..96350f6e 100644 --- a/scripts/Windows/Scripts/WSL.ps1 +++ b/scripts/Windows/Scripts/WSL.ps1 @@ -40,6 +40,14 @@ function Test-WslDistributions { & { $null = wsl -l; $?; }; } +<# + .SYNOPSIS + Checks whether the managed distribution is installed. +#> +function Test-WslDistribution { + & { $null = wsl -d (Get-WslDistributionName) -e true; $?; }; +} + <# .SYNOPSIS Installs `wsl` on the system.