Powershell script for retrieving stored wireless passwords

Door Jan Steenbeek In Samenwerken

On W10 it is trivially easy to retrieve stored passwords for wireless netwerk. I cobled the following script together to store the passwords before a migration. Note that this assumes an English version of Windows, on some machines you may need to modify the ‘User Profiles’ and ‘Key Content’ strings.

Run the following to find the string on your system;


And the full script:

$output = netsh wlan show profiles
$from = $output.IndexOf(“User profiles”)

$output = $output[($from+2)..($output.length-2)]

$results = @()

foreach ($entry in $output) {
  $networkName = ($entry.Split(‘:’)[1]).Trim()

  $networkInfo = netsh wlan show profile name=$networkName key=clear

  foreach($infoLine in $networkInfo) {
    if ($infoLine.Trim().StartsWith(“Key Content”)){
      $password = ($infoLine.Split(‘:’)[1]).Trim()

      if ($password -ne “Absent”){
        Write-Host Processing $networkName
        $networkProperties = @{
          Name = $networkName
          Password = $password
                      $results += (New-Object PSObject -Property $networkProperties)

$results | ft Name,Password

Meer informatie


Jan Steenbeek

SharePoint Architect

+31 6 22 98 69 52 Stuur Jan een e-mail


Er zijn nog geen reacties op dit bericht.

Plaats een reactie

Dit veld is verplicht.

Vul een geldig e-mailadres in.

Dit veld is verplicht.