Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@adamazad adamazad commented Apr 15, 2014

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

This comment has been minimized.

Copy link

@aracknobus aracknobus commented Feb 25, 2016

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

This comment has been minimized.

Copy link

@sacvir 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

@Leleu256

This comment has been minimized.

Copy link

@Leleu256 Leleu256 commented Feb 19, 2017

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

This comment has been minimized.

Copy link

@cheles 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

This comment has been minimized.

Copy link

@ExaFlop1 ExaFlop1 commented Feb 4, 2019

Is there any way to export wlan profiles from offline installation

@InBinceAble81

This comment has been minimized.

Copy link

@InBinceAble81 InBinceAble81 commented Apr 17, 2021

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

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