PoshCode Archive  Artifact [7c0a7a3c02]

Artifact 7c0a7a3c02083e8ea2663dd5dfdfeaf76768d9aebc482def73210674f83e5a92:

  • File Export-WLANSettings.ps1 — part of check-in [e8f7eda4be] at 2018-06-10 13:44:01 on branch trunk — Using netsh.exe to loop through each WLAN on the system and export the settings to the user-provided output-file. (user: Jan Egil Ring size: 1378)

# encoding: ascii
# api: powershell
# title: Export-WLANSettings.ps1
# description: Using netsh.exe to loop through each WLAN on the system and export the settings to the user-provided output-file.
# version: 0.1
# author: Jan Egil Ring
# license: CC0
# x-poshcode-id: 4635
# x-archived: 2015-07-29T08:51:10
# x-published: 2015-11-23T19:48: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