mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-14 09:58:59 +01:00
Updated list-wsl-distros.ps1
This commit is contained in:
parent
ad73e693cb
commit
b8d9a4dc19
@ -2,9 +2,12 @@
|
||||
.SYNOPSIS
|
||||
Lists distros for Windows Subsystem for Linux
|
||||
.DESCRIPTION
|
||||
This PowerShell script lists available Linux distributions for Windows Subsystem for Linux (WSL).
|
||||
This PowerShell script lists installed/available Linux distributions for Windows Subsystem for Linux (WSL).
|
||||
.EXAMPLE
|
||||
PS> ./list-wsl-distros.ps1
|
||||
NAME STATE VERSION
|
||||
* Ubuntu-24.04 Stopped 2
|
||||
...
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -12,11 +15,15 @@
|
||||
#>
|
||||
|
||||
try {
|
||||
if ($IsLinux -or $IsMacOS) { throw "Requires Windows Subsystem for Linux (WSL)" }
|
||||
|
||||
& wsl.exe --list --verbose
|
||||
" "
|
||||
& wsl.exe --list --online
|
||||
" "
|
||||
& wsl.exe --status
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
"⚠️ Error: $($Error[0]) in script line $($_.InvocationInfo.ScriptLineNumber)."
|
||||
exit 1
|
||||
}
|
Loading…
Reference in New Issue
Block a user