diff --git a/Set-NetworkAdapter.ps1 b/Set-NetworkAdapter.ps1 index f8b6e23..c37bcd4 100644 --- a/Set-NetworkAdapter.ps1 +++ b/Set-NetworkAdapter.ps1 @@ -46,8 +46,23 @@ function Get-AdapterChoice { $macLinux = $macWindows -replace '-', ':' Write-Host "$index. $($adapter.Name)" -ForegroundColor White - Write-Host " $($adapter.InterfaceDescription) $status" -ForegroundColor Gray - Write-Host " IP: $ipAddress | MAC: $macWindows ($macLinux)" -ForegroundColor Cyan + + # Colored description + status + $statusLabel = if ($adapter.Status -eq 'Up') { 'CONNECTED' } else { $adapter.Status.ToUpper() } + if ($adapter.Status -eq 'Up') { $statusColor = 'Green' } + elseif ($adapter.Status -in @('Down','NotPresent','Not Present')) { $statusColor = 'Red' } + else { $statusColor = 'Yellow' } + + Write-Host " $($adapter.InterfaceDescription) " -ForegroundColor Gray -NoNewline + Write-Host "[$statusLabel]" -ForegroundColor $statusColor + + # Colored IP and MAC display + if ($ipv4) { + Write-Host " IP: $ipAddress" -ForegroundColor Cyan -NoNewline + } else { + Write-Host " IP: No IP" -ForegroundColor DarkYellow -NoNewline + } + Write-Host " | MAC: $macWindows ($macLinux)" -ForegroundColor DarkGray $index++ }