Browse Source

fix for WSL

pull/450/head
Dmitry Nefedov 2 years ago
parent
commit
8d244ad5b1
  1. 4
      src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
  2. 4
      src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

4
src/Sophia_Script_for_Windows_11/Module/Sophia.psm1

@ -9290,8 +9290,8 @@ function Install-WSL
$wsl = wsl --list --online $wsl = wsl --list --online
# We need to get the string number where the "FRIENDLY NAME" header begins to truncate all other unnecessary strings in the beginning # We need to get the string number where the "FRIENDLY NAME" header begins to truncate all other unnecessary strings in the beginning
$LineNumber = ($wsl | Select-String -Pattern "FRIENDLY NAME" -CaseSensitive).LineNumber $LineNumber = ($wsl | Select-String -Pattern "FRIENDLY NAME" -CaseSensitive).LineNumber
# Remove first strings in output from the first to the $MinimumLineNumber # Remove first strings in output from the first to the $LineNumber
$Distros = ($wsl).Replace(" ", "").Replace("* ", "")[($MinimumLineNumber)..(($wsl).Count)] | ForEach-Object -Process { $Distros = ($wsl).Replace(" ", "").Replace("* ", "")[($LineNumber)..(($wsl).Count)] | ForEach-Object -Process {
[PSCustomObject]@{ [PSCustomObject]@{
"Distro" = $_ -split " ", 2 | Select-Object -Last 1 "Distro" = $_ -split " ", 2 | Select-Object -Last 1
"Alias" = $_ -split " ", 2 | Select-Object -First 1 "Alias" = $_ -split " ", 2 | Select-Object -First 1

4
src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

@ -9292,8 +9292,8 @@ function Install-WSL
$wsl = wsl --list --online $wsl = wsl --list --online
# We need to get the string number where the "FRIENDLY NAME" header begins to truncate all other unnecessary strings in the beginning # We need to get the string number where the "FRIENDLY NAME" header begins to truncate all other unnecessary strings in the beginning
$LineNumber = ($wsl | Select-String -Pattern "FRIENDLY NAME" -CaseSensitive).LineNumber $LineNumber = ($wsl | Select-String -Pattern "FRIENDLY NAME" -CaseSensitive).LineNumber
# Remove first strings in output from the first to the $MinimumLineNumber # Remove first strings in output from the first to the $LineNumber
$Distros = ($wsl).Replace(" ", "").Replace("* ", "")[($MinimumLineNumber)..(($wsl).Count)] | ForEach-Object -Process { $Distros = ($wsl).Replace(" ", "").Replace("* ", "")[($LineNumber)..(($wsl).Count)] | ForEach-Object -Process {
[PSCustomObject]@{ [PSCustomObject]@{
"Distro" = $_ -split " ", 2 | Select-Object -Last 1 "Distro" = $_ -split " ", 2 | Select-Object -Last 1
"Alias" = $_ -split " ", 2 | Select-Object -First 1 "Alias" = $_ -split " ", 2 | Select-Object -First 1

Loading…
Cancel
Save