# Windows batch file or script to load exported Wi-Fi XML profiles onto a new laptop

This probably is as simple as reconfiguring the standard code used by MS for the same thing but .. I hope maybe someone has already done it.
You can easily export a Wi-Fi profile to a USB including all necessary parts to import in new laptop so that Wi-Fi profiles are preloaded. But as far as I can tell, I have to run it one for each profile. Which is OK to create them.
But to load them, I need to be able to do a one click, you're done for two profiles where I work. Every time someone new comes in, I have to add both profiles. I had been doing them manually until I found not necessary now. Still, there are times when the MS way isn’t good enough for the people I have to deal with. Most can only handle a CLICK at best. If they are out of town when they get a new system, I have to preload the profiles by remote. It would be very nice if I could sent them a preloaded script to just "click" that had both profiles in it. Additionally, this would let me change ALL the passwords for both profiles and simply send out an email with an "automatic profile loader" script. Last part is maybe hardest. Need to covert to exe once done so that they users cannot edit or even read what MS felt they needed to put in plaintext, the Wi-Fi passwords (???? why???)

Better yet, if the script could delete itself after it runs then I won't have to worry about anyone I don't know popping in on the Wi-Fi.

Any suggestions appreciated. Getting the XML's is easy and I have found a number of other Free software that do a lot more but this is the only single part of my life that is pure misery as I get chewed out for being "security proactive" if the people I send the XML's to (with instructions) still can't load them.

## 1 Answer

After exporting a profile in XML format, you can import it on another PC using the following command:

netsh wlan add profile filename="Drive:\Path\to\profile.xml"


You can also specify an interface to import the profile; this option is useful if the computer has multiple wireless adapters. You can also specify that you want to apply the profile to all users of the computer, or just to the current user. For example:

netsh wlan add profile filename="Drive:\Path\to\profile.xml" interface="Wireless Network Connection" user=current


If you don't specify an interface, Windows adds it for all interfaces by default. Also, if you don't specify the user parameter, Windows adds the profile for all users.

You can add these commands to a batch file, that executes them and then deletes both the XML and itself.

If you need an EXE, you'll have to use some other method (or look into some "Batch to EXE" type programs). As for the keys, unless you explicitly use key=clear while exporting the profile using netsh, the XML file will include encrypted keys.