# encoding: ascii
# api: powershell
# title: Export-WLANSettings.ps1
# description: 01000000D08C9DDF0115D1118C7A00C04FC297EB0100000038E0073A45F0CA4BB5EB5855EFD39A2C000000000200000000001066000000010000200000005870AD66D8E09E9D67E5AF7F03F1FAB2B5529B29938467442A8232AD455F9599000000000E8000000002000020000000F7D020B7010BA0349470C14355821C3E5E894CA7786AB063F7380248EA5E4F7F1000000004BD22EF8317103D54E3AE15B0602D3A4000000065A70573F8ECCB76E09B190F225A3D032397848328732EFD35128514FB460E21AF109C0F8193840C4FD8F1D18CB0FDD24FC67DEA1A9EA0A817BE895AE63BE70F
# version: 0.1
# author: Jan Egil Ring
# license: CC0
# x-poshcode-id: 4002
# x-archived: 2015-07-29T08:32:57
# x-published: 2015-03-06T22:41:00
#
#
# ==============================================================================================
#
#
# NAME: Export-WLANSettings.ps1
#
# AUTHOR: Jan Egil Ring
#
# DATE : 14.03.2010
#
# COMMENT: Using netsh.exe to loop through each WLAN on the system and export the settings to the user-provided output-file.
# Must be run with Administrator-privileges for the Key Content (security key) to be exported.
#
#
# ==============================================================================================
Write-Warning "Must be run with Administrator-privileges for Key Content to be exported"
$filepath = Read-Host "Provide path to output-file. E.g. C:\temp\wlan.txt"
$wlans = netsh wlan show profiles | Select-String -Pattern "All User Profile" | Foreach-Object {$_.ToString()}
$exportdata = $wlans | Foreach-Object {$_.Replace(" All User Profile : ",$null)}
$exportdata | ForEach-Object {netsh wlan show profiles name="$_" key=clear} | Out-File $filepath