TL;DR: Check out my script on GitHub here.
On occasion, you may find the need to backup, restore, or transfer saved wireless networks from one Windows device to another. Whether you’ve gotten a new laptop that needs to be reconnected to your favorite hotspots or you simply want to back up your saved networks in case of need, this can be done with tools built right into Windows using a series of simple commands.
The first thing you’ll want to do is create a new folder to keep the backup files organized in as each network will be backed up to its own file. For example, you may want to create a backup folder on your desktop, like so:
mkdir C:\Users\%username%\Desktop\WifiBackup
To back up a single network to a file, run the following command, replacing “FBISurveillanceVan” with the name of your WiFi network:
netsh wlan export profile "FBISurveillanceVan" key=clear folder="C:\Users\%username%\Desktop\WifiBackup"
Or, to back up all saved networks on your device, use this command:
netsh wlan export profile key=clear folder="C:\Users\%username%\Desktop\WifiBackup"
Restoring WiFi networks to a device which have been backed up in this manner can be restored using the following command, again replacing “FBISurveillanceVan” with the name of your WiFi network:
netsh wlan add profile filename="C:\Users\%username%\Desktop\WifiBackup\Wi-Fi-FBISurveillanceVan.xml" user=current
Unfortunately, if you have multiple backups you need to restore, they must be restored one at a time and cannot all be restored with a single command. Thankfully, a few lines of code and a simple loop can fix this problem for us.
To restore multiple WiFi networks at once, open a PowerShell window and run the following command:
$DesktopPath = [System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::Desktop)
$Files = Get-ChildItem "$DesktopPath\WifiBackup"
foreach ($File in $Files){
netsh wlan add profile filename="$($File.fullname)" user=current
}
While this method works, it’s still just a tad bit too manual for me, which is why I created a Manage-WiFiNetworks.ps1 script, available on my GitHub. Using this script, you can simply specify the -Backup
parameter to backup all networks, and the -Restore
parameter to restore previously backed-up networks.
Additionally, if you want to forget all saved networks (such as before going to Defcon), you can do so with the -Wipe parameter (just be sure to back them up first.)
One reply on “WiFi Network Backup & Restore Script”
[…] You can find it on my GitHub here. […]