luktom.net
  • blog
  • contact
  • polish





Export WiFi passwords in Windows

On 28 Dec, 2017
Windows
No Comments
Views : 3202

Recently I’ve changed my old laptop (Toshiba Z30) to Surface Pro LTE. I needed to migrate the data to the new laptop including the WiFi list with passwords.

Of course one can click through the WiFi control panel and write down all the passwords, but I don’t recommend that as there’s an easier way to accomplish the goal using PowerShell :)

Below there’s a function that is based on a script I found in Google. The function returns a hash with a network name and it’s password:

function Get-WifiCredentials() {
    mkdir wifi
    cd wifi

    netsh wlan export profile key=clear

    $credentials = @{}

    Get-ChildItem *.xml | % {
        $xml=[xml] (Get-Content $_)

        $name = $xml.WLANProfile.SSIDConfig.SSID.name
        $key = $xml.WLANProfile.MSM.Security.sharedKey.keymaterial
        
        if (![String]::IsNullOrWhitespace($key)) 
        {
            $credentials.Add($name, $key)
        }
    }

    cd ..
    rmdir -recurse wifi

    return $credentials
}


Tags :   powershellwifiwindows

Leave a Comment

Click here to cancel reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>





Łukasz Tomaszkiewicz

Łukasz Tomaszkiewicz

Łukasz Tomaszkiewicz is a highly skilled and passionate cloud expert who loves to automate repeatable things and secure them.

His broad experience in the areas of software development, database design, containerization and cloud infrastructure management gives him a holistic view of a modern technology stack.

In his spare time he enjoys photography, blogging and speaking on local IT-related communities.

Vim-believer :)

Categories

  • Ansible
  • AWS
  • C#
  • Go
  • Google Cloud
  • Kubernetes
  • Prometheus
  • Speeches
  • Virtualization
  • Windows

Tags

alert alerting alertmanager ansible ansible operator argocd aws aws cli aws ug bash c# centos cloudwatch databases esxi flux gcp gitops google cloud k8s kubernetes linux mysql open source operator operator-sdk policies powershell prelekcje prometheus recovery restore rhel rpo rto scp speeches terraform virtualization vmware vsan vsphere weaveworks wifi windows

Copyright © 2006-2018 by Łukasz Tomaszkiewicz. Wszelkie prawa zastrzeżone