Wifi Profiles not being saved

I have been using the native Wifi functions to interact with our wireless device. I was able to do this using the link here: Wifi Registry to take out the Connection Manager so wifi functions were available.

This has worked, but there is a problem. It seems that any wifi profiles are not saved, and on reboots they are lost. This means no auto connection and having to type in credentials everytime.

When the connection manager is left in and used, it does save the profiles correctly and the auto connection works fine after a reboot.

Is it possible that the registry settings to take away Connection Manager also mess with wifi profile saving? The registry settings in the link are for WEC7, could that also be a problem? Any other ideas?

Dear @Cerealkiller050 (I like the name :smiley: )

The connection manager takes care of storing the profiles and auto-connecting to different WiFi networks.

Profile Storage

There is a solution for the profile storage: Profiles are stored in XML files, in the folder

\Windows\Wlan\CommonAppData\Microsoft\Wlansvc\Profiles\ ...

. To reuse profiles (including the credentials stored in the profile), a special procedure is required:

  • Once you connected through a profile, backup the matching XML file(s).

  • Activate EarlyAutoCopy


  • Store the XML file(s) at

    \Flashdisk\EarlyAutoCopy\Windows\Wlan\CommonAppData\Microsoft\Wlansvc\Profiles\ …
    The XML files will get copied back to the original location early in the boot process.


For the AutoConnect, I’m not aware of any simple solution. You probably will have to use the native WiFi API functions to establish a connection. There is a sample application on our developer page


Thanks for the help Andy, this clears some things up for me.

As for the AutoConnect, I will use the notifications from WlanRegisterNotification and should be able to roll my own.

I am using the WlanTool that came with the WEC2013 with a thin API wrapper around, and it says this during the profile creation/saving…

// Set Profile First
// If connecting to Infrastructure networks auto connection will kick in
// If connecting to adhoc we have to set profile first and then do a manual connect

So reading that, I though that the auto connection settings were somewhere else or something, hence my question.

Thanks again!


I have gotten around to wiring up the saved profiles. I am able to save the profiles to EarlyAutoCopy and they are successfully restored after boot.

However, I am still getting a problem. When I try to use WlanGetProfile() for the saved profile, it is never found. Instead, I connect and it makes another one (with the same profile name). After it does this, it is able to find it from then on until reboot, where it happens the first time again. The only difference in the profiles it makes is that the keymaterial is slightly altered.

Seems like there is a missing component that is missing across reboots. Any ideas?



Dear @Cerealkiller050

I discussed the issue with some other developers. Unfortunately we don’t have any idea what could cause the problem.
Maybe you can find additional hints in Microsoft’s Native Wi-Fi documentation.

Regards, Andy


I was able to work around this problem by doing the following:

On connection of a network, I save the new profile listing that is created in \Windows\Wlan… folder to a folder on the flashdisk (I called mine WifiProfiles). This folder does NOT get copied automatically on boot.

On next boot, I manually enumerate through the saved wifi profile .xml file list and call WlanSetProfile() for each. By using WlanSetProfile(), it fixes the problem of Windows not being able to find it in it’s internal profile store (which it uses to search instead of the \Windows\Wlan… it appears). Now it does find the profiles after boot.

The one drawback is that using WlanSetProfile() causes Windows to make new profiles in the \Windows\Wlan… folder with different names (problem described in above comment). I simply just clear the saved directory on my flashdisk and copy back these new ones it created.

This seems to work and persist across reboots. Now I am able to search/retrieve wifi profiles and use them for the auto connection I wrote.

Thanks for the help and direction!

Dear @Cerealkiller050
Thank you for sharing your solution. I’m sure this will help others with similar requirements!
Regards, Andy