Skip to content

Instantly share code, notes, and snippets.

@dolmen
Created March 10, 2011 17:54
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save dolmen/864551 to your computer and use it in GitHub Desktop.
Save dolmen/864551 to your computer and use it in GitHub Desktop.
Export all Windows Wifi profiles (SSID, password) in XML
:: Run with full administrator rights
netsh wlan export profile folder=. key=clear
@echo off
if "%~1"=="" goto :Usage
setlocal
mkdir "%~1" || exit /B 1
netsh wlan export profile "folder=%~1" key=clear >nul
:: Get current code page
for /F "tokens=2 delims=:" %%P in ('chcp') do set CP=%%P
set CP=%CP:~1%
:: Switch to UTF-8
chcp 65001 >nul
(
echo ^<?xml version="1.0" encoding="UTF-8"?^>
echo ^<WLANProfiles^>
for %%P in ("%~1\*") do echo ^<WLANProfile href="%%~nxP"/^>
echo ^</WLANProfiles^>
) > "%~1\index.xml"
:: Restore code page
chcp %CP% >nul
exit /B 0
:Usage
echo usage: %~n0 ^<directory^>
@adamazad
Copy link

Hi, I'm really interested in this Gist, but I couldn't get it to work, CMD newbie :/ can you guide to use this? thanks in advance

@aracknobus
Copy link

Hi, i've just found this and this is quite useful, but what is the reason to make an index file? It can be imported?

@sacvir
Copy link

sacvir commented Jun 8, 2016

"netsh wlan show profiles [ssid name] key=clear”
I have a doubt that, How it displays a (password / network key) when we give the command key=clear. Normally the key is encrypted, then how command prompt decrypt it and shows password when we give key=clear.
Kindly reply me to: shivarv93@outlook.com

@SnakeNET64
Copy link

I've a shorter method :

mkdir wifi
cd wifi

netsh wlan export profile key=clear

dir *.xml |% {
$xml=[xml] (get-content $_)
Write-Host $xml.WLANProfile.SSIDConfig.SSID.name `t $xml.WLANProfile.MSM.Security.sharedKey.keymaterial
}

cd ..
rmdir -recurse wifi

@cheles
Copy link

cheles commented Oct 1, 2018

"netsh wlan show profiles [ssid name] key=clear”
I have a doubt that, How it displays a (password / network key) when we give the command key=clear. Normally the key is encrypted, then how command prompt decrypt it and shows password when we give key=clear.
Kindly reply me to: shivarv93@outlook.com

Read about WLAN_PROFILE_GET_PLAINTEXT_KEY here

@ExaFlop1
Copy link

ExaFlop1 commented Feb 4, 2019

Is there any way to export wlan profiles from offline installation

@InBinceAble81
Copy link

from what I seen on youtube you need to open the cmd prompt on administrator then you type the first " netsh wlan show profile "
then the profiles show up. then you type " netsh wlan export profile folder=C:\ key=clear " then you go in the folder section on ur computer go to C: itll have a xml file there you open it with notepad or what ever you choose itll have the password. hope this helped am just trying to learn this as well.

InBinceAble81 aka ik0n

@Vlad3lou
Copy link

InBinceAble81. You will most likely help me with this. I made a code where this data should have been sent to me immediately by email, but there were errors, and so it is possible to create a file, read it and send data from them to email, for convenience, you can delete the created file after sending it to email.
I'm sorry for my English, I'm from Ukraine. @InBinceAble81

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment