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