Set Wi-Fi settings automatically

slaurent

New Member
Hello, I would like to automatically set my WIFI network in my image Windows 10 or Windows 11, how to thank you
 
Run commands on your WiFi-connected system:
Code:
netsh wlan show profiles
netsh wlan export profile WiFiNetworkName key=clear folder=.

Replace WiFiNetworkName with the actual network name. It makes it easier for you to know which network we're exporting.

From Post-Setup:
- Add File WiFiNetworkName.xml to Before logon, Copy only
- Add Command
Code:
netsh wlan add profile filename="%WINDIR%\Setup\WiFiNetworkName.xml" user=all

Mod note: I've updated the command to export the profile using a clear text password.

This is obviously a security risk if someone finds your ISO, but newer Wi-Fi security protocols encrypt the password using a local key. That key can't be transferred to a new system, so it leaves no choice but to save the clear password.
 
Last edited by a moderator:
Est-ce une bonne idée de récupérer le fichier de profil.xml d'une station déjà connectée au réseau que je rajouterai ?
 
Ou je dois copier le fameux fichier XML, désolé pour les questions bêtes mais je commence par ce logiciel
 
Please post in English, for our other readers. You can edit the XML, but exporting a current profile is the best answer for beginners.
 
Thank you for the information, do you have an example of SSIDNetworkName.xml file

Is it a good idea to recover the.xml profile file of a station already connected to the network that I will add?

Or I have to copy the famous XML file, sorry for silly questions but I start with this software

Sorry
 
Export your settings from a connected PC, it can be any Windows version.

Everyone will have a different XML, depending on what type of WiFi security (WPA, WPA2, Personal/Enterprise). You also want to export settings to keep your password encrypted, and not written as plain-text. If you need XML examples, see post #4.
 
xinhuiwong asked the next question: Why doesn't my WiFi automatically connect?
Windows doesn't connect to WiFi networks by default, and it's possible to have multiple profiles. Your options include:

1. Force a one-time WiFi connection:
Code:
netsh wlan connect SSID=SSIDName name=WiFiProfileName

2. Change Windows to automatically connect to this network:
Code:
netsh wlan set profileparameter name=WiFiProfileName connectionmode=auto
 
Hello, thank you for all the information.
I see that I have to use XML configuration files and other types, how I integrate them in my image, for example the WIFI profile configuration file

1660029793087.png
 
Hello I Try it but it dosent work for me

1667472397153.png

It dosent connect to the Wifi at the start.
Where is the error? i cant find it
 
Hi there,

I've followed this guide, however I'm having an issue where upon first user login, the Wifi hangs at "Connecting". Running
Code:
netsh wlan show profiles
does indeed show that my xml file with my network settings copied to the installation correctly. Is there something else that needs to happen? When I run the same command directly from CMD on a fresh install, I can get the wifi working instantly - no need to even run the second command to set the network to autoconnect. Of course I have to change the file path when I run the command manually after install to point to the .xml file I copied to the desktop.
 
Last edited:
You can redirect output to log file by adding " > C:\path\log.txt" to your netsh parameters. This might reveal some useful details.

Code:
netsh wlan add profile filename="%WINDIR%"\Setup\WiFiNetworkName.xml user=all > C:\log1.txt
netsh wlan set profileparameter name=WiFiProfileName connectionmode=auto > C:\log2.txt
 
Last edited by a moderator:
You can redirect output to log file by adding " > C:\path\log.txt" to your netsh parameters. This might reveal some useful details.

Code:
netsh wlan add profile filename="%WINDIR%"\Setup\WiFiNetworkName.xml user=all > C:\log1.txt
netsh wlan set profileparameter name=WiFiProfileName connectionmode=auto > C:\log2.txt
Just tried this. For log1, I'm getting "There is no such wireless interface on the system". For log2, I'm getting "Profile "SC" is not found on any interface." What is strange is that some times on a fresh install with this USB, running
Code:
netsh wlan show profiles
yields no results at all. Perhaps the system is not detecting the wireless system by the time the network profile is to be copied, hence why nothing is showing up under profiles (I'm assuming Windows nukes the profiles folder or creates a new one once a wireless card is detected.) How do I get around this?
 
Last edited by a moderator:
The obvious question is when are the WiFi drivers installed? Are they integrated into the image? Loaded during Post-Setup?
Does your profile name have spaces, which need quotes surrounding it?

If you're using Unattended setup, remove any named user accounts. Install as normal, OOBE will stop and ask you to create an user.
Open a CMD window with shift-F10, and check if your network is configured ("ipconfig /all").
 
The wifi drivers I'm using for these machines are built-in to Windows. I have some other machines I will need to load drivers for, but I haven't done that yet. My user account I was creating had no abnormal characters besides an underscore. I was skipping "Network configuration" in OOBE, but I've put all of the OOBE parameters back to stock. Now, I'm getting a BSOD after I install the OS talking - something to do with nvstor.sys. I have solved this in the past by creating a fresh NTLite config and just re-adding everything I need. I will deal with that then continue testing.
 
OK. Rebased the installer on the same Windows ISO to fix the BSOD problem. I disabled the automatic user creation. The first thing I'm prompted with is the network menu to sign into a wifi network. I'm not a huge Windows guy, so not sure exactly what to look for in the output of
Code:
ipconfig /all
, but it appears that none of the network interfaces are connected at this stage. Once again, my output from log1 is "There is no such wireless interface on the system". However, this time log2 does not even generate. Attached is an image of my Post-Setup screen, as well as my current autounattend.xml Untitled.png
 

Attachments

  • autounattend.xml
    3.8 KB
Back
Top