Gespeicherte WLAN-Passwörter anzeigen

Listet die WLAN-Netze, die auf diesem PC gespeichert sind, mit Passwort auf – praktisch, wenn Gäste ins WLAN sollen und niemand das Passwort mehr weiß. Passwort per Nummer kopieren, auf Wunsch weiter zum WLAN-QR-Code-Generator. Nur für den eigenen PC gedacht. Benötigt Administratorrechte.

wlan-passwoerter.cmd 4,2 KB · läuft unter Windows 10/11 · aktualisiert am 17.10.2026 · 0 Downloads

SHA-256: 583b3b561398b5d8d0b266af045d4cb32c97cb902c244fa6adfa2ddba8f3866d

Code

So sieht die Datei aus, die Sie herunterladen (85 Zeilen). Die Kommentare oben im Skript erklären, was es tut.

wlan-passwoerter.cmd
<# : Friederich-IT - Gespeicherte WLAN-Passwoerter
@echo off
setlocal
chcp 65001 >nul
title WLAN-Passwörter - Friederich-IT
set "FIT_SELF=%~f0"
powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "iex ([IO.File]::ReadAllText($env:FIT_SELF,[Text.Encoding]::UTF8))"
exit /b %errorlevel%
#>
# ==========================================================================
#  Gespeicherte WLAN-Passwörter                    Version 1.0, Oktober 2026
#  https://friederich-it.de/downloads
#
#  Zeigt die WLAN-Netze, die auf DIESEM PC gespeichert sind, samt Passwort.
#  Praktisch, wenn Gäste oder ein neues Gerät ins WLAN sollen und niemand
#  das Passwort mehr weiß. Liest nur Daten aus, die Windows ohnehin
#  gespeichert hat; ändert nichts. Benötigt Administratorrechte.
#  Tipp: Mit https://friederich-it.de/alltag/wlan-qr wird daraus ein
#  QR-Code zum Scannen mit dem Handy.
# ==========================================================================
$ErrorActionPreference = 'SilentlyContinue'
try { [Console]::OutputEncoding = [Text.Encoding]::UTF8 } catch {}
$admin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $admin) {
    Write-Host '  Administratorrechte werden angefordert ...'
    try { Start-Process -FilePath $env:FIT_SELF -Verb RunAs -ErrorAction Stop | Out-Null }
    catch { Write-Host '  Abgebrochen: Ohne Administratorrechte zeigt Windows die Passwörter nicht an.' -ForegroundColor Yellow; [void][Console]::ReadKey($true) }
    exit
}

function Get-Feld([string[]]$zeilen, [string]$muster) {
    foreach ($z in $zeilen) { if ($z -match "^\s*(?:$muster)\s*:\s?(.*)$") { return $Matches[1].Trim() } }
    return $null
}

Write-Host ''
Write-Host '  Gespeicherte WLAN-Passwörter' -ForegroundColor Cyan
Write-Host '  ============================' -ForegroundColor Cyan
Write-Host ''

$liste = @(netsh wlan show profiles 2>$null)
$namen = @($liste | ForEach-Object { if ($_ -match '^\s*(?:Profil für alle Benutzer|All User Profile|Benutzerprofil|User Profile)\s*:\s?(.+)$') { $Matches[1].Trim() } } | Where-Object { $_ })
if ($namen.Count -eq 0) {
    Write-Host '  Keine gespeicherten WLAN-Netze gefunden (oder kein WLAN-Adapter vorhanden).' -ForegroundColor Yellow
    Write-Host ''
    Write-Host '  Taste drücken ...' -ForegroundColor DarkGray
    [void][Console]::ReadKey($true)
    exit
}

$netze = foreach ($n in $namen) {
    $info = @(netsh wlan show profile name="$n" key=clear 2>$null)
    $pw = Get-Feld $info 'Schlüsselinhalt|Key Content'
    $auth = Get-Feld $info 'Authentifizierung|Authentication'
    $typ = if ($pw) { 'WPA' } elseif ($auth -match 'Offen|Open') { 'nopass' } else { 'WPA' }
    [pscustomobject]@{ Netz = $n; Passwort = $(if ($pw) { $pw } elseif ($typ -eq 'nopass') { '(offenes Netz)' } else { '(nicht gespeichert)' }); Sicherheit = $auth }
}

$i = 0
foreach ($e in $netze) {
    $i++
    Write-Host ('  {0,2}. ' -f $i) -NoNewline -ForegroundColor DarkGray
    Write-Host ('{0,-32}' -f $e.Netz) -NoNewline
    Write-Host $e.Passwort -ForegroundColor Green -NoNewline
    if ($e.Sicherheit) { Write-Host ("   ($($e.Sicherheit))") -ForegroundColor DarkGray } else { Write-Host '' }
}
Write-Host ''
Write-Host '  Bitte vertraulich behandeln: Wer das Passwort kennt, ist in Ihrem Netz.' -ForegroundColor DarkGray
Write-Host ''
while ($true) {
    Write-Host '  [Nummer] Passwort kopieren   [A] alle kopieren   [Q] QR-Code-Seite öffnen   [Enter] Beenden' -ForegroundColor DarkGray
    $e = Read-Host '  Auswahl'
    if (-not $e) { break }
    if ($e -match '^\d+$' -and [int]$e -ge 1 -and [int]$e -le $netze.Count) {
        $w = @($netze)[[int]$e - 1]
        Set-Clipboard -Value $w.Passwort
        Write-Host "  Passwort von ""$($w.Netz)"" kopiert." -ForegroundColor Green
    } elseif ($e -in 'a', 'A') {
        Set-Clipboard -Value ((@($netze) | ForEach-Object { "$($_.Netz)`t$($_.Passwort)" }) -join "`r`n")
        Write-Host '  Alle Einträge kopiert.' -ForegroundColor Green
    } elseif ($e -in 'q', 'Q') {
        Start-Process 'https://friederich-it.de/alltag/wlan-qr'
    }
}