Files
lxs/windows/tools/index.ps1
T

76 lines
3.0 KiB
PowerShell

<#
LXS - Tools index (Windows)
Description: Interactive menu listing the scripts in windows\tools
Repo: https://git.hyko.cx/hykocx/lxs
#>
# Load LXS common library (colors, UI helpers, spinner, loggers, guards).
# Prefers the sibling ..\lib\common.ps1 (repo checkout or installed layout) and
# only hits the network when this script is run standalone.
$LxsRawBase = if ($env:LXS_RAW_BASE) { $env:LXS_RAW_BASE } else { 'https://git.hyko.cx/hykocx/lxs/raw/branch/main' }
if (-not $env:LXS_RAW_PLATFORM_BASE) { $env:LXS_RAW_PLATFORM_BASE = "$LxsRawBase/windows" }
$LxsLibPath = if ($PSScriptRoot) { Join-Path $PSScriptRoot '..\lib\common.ps1' } else { $null }
if ($LxsLibPath -and (Test-Path $LxsLibPath)) {
. $LxsLibPath
} else {
try {
$LxsLibSource = Invoke-RestMethod -Uri "$env:LXS_RAW_PLATFORM_BASE/lib/common.ps1" -UseBasicParsing -ErrorAction Stop
} catch {
Write-Error 'Failed to fetch lib/common.ps1'
exit 1
}
. ([scriptblock]::Create($LxsLibSource))
}
function Show-LxsToolsMenu {
while ($true) {
Clear-Host
Show-LxsBoxTop -Title 'TOOLS' -Right 'WIN_TOOLBOX'
Write-Host ''
Show-LxsMenuItem '01' 'System Infos' 'hardware, os, processes'
Show-LxsMenuItem '02' 'Network Diag' 'ip, dns, ports, repair'
Show-LxsMenuItem '03' 'Disk Cleanup' 'temp, update cache, winsxs'
Show-LxsMenuItem '04' 'System Repair' 'sfc, dism, chkdsk'
Show-LxsMenuItem '05' 'Restore Point' 'create, list, roll back'
Show-LxsMenuItem '06' 'Update Windows' 'windows update + winget'
Show-LxsMenuItem '07' 'Harden Windows' 'firewall, smb, defender'
Show-LxsMenuItem '08' 'Remote Access' 'rdp + openssh server'
Show-LxsMenuItem '09' 'Debloat' 'remove apps, telemetry off'
Show-LxsMenuItem '00' 'BACK' '' -Exit
Write-Host ''
Show-LxsBoxBottom
Write-Host ''
$choice = Read-LxsChoice
$script = switch -Regex ($choice) {
'^0?1$' { 'tools\system-info.ps1' }
'^0?2$' { 'tools\net-diag.ps1' }
'^0?3$' { 'tools\cleanup.ps1' }
'^0?4$' { 'tools\repair.ps1' }
'^0?5$' { 'tools\restore-point.ps1' }
'^0?6$' { 'tools\update-windows.ps1' }
'^0?7$' { 'tools\harden.ps1' }
'^0?8$' { 'tools\remote-access.ps1' }
'^0?9$' { 'tools\debloat.ps1' }
'^0?0$' { 'BACK' }
default { $null }
}
if ($script -eq 'BACK') { return }
if (-not $script) {
Write-LxsErr 'Invalid protocol. Select 0-9.'
Start-Sleep -Seconds 1
continue
}
$code = Invoke-LxsSibling -RelativePath $script -SelfDirectory $PSScriptRoot
# Exit code 75 from a child means it already paused on its own
# (its own "Back" or end-of-run prompt) — skip the redundant prompt.
if ($code -ne 75) { Read-LxsEnter }
}
}
Show-LxsToolsMenu
exit 75