Set Wi-Fi settings automatically

Commands are in the wrong pane. Bottom half is User Execution, or running as YOU. Top half runs as SYSTEM.
Move the "wlan set profileparameter" command after "wlan add profile" (Move up/down arrows in menu bar). Order of execution does matter!

Fortunately, you only need to redo 5 lines...
 
I tried that already, still doesn't work unfortunately. I realized I messed up the order before I took that screenshot, but I did fix it on my end. Originally, I had everything in the "Machine" section up top, but I couldn't get some commands to work, such as powercfg. I have just tried again with just the netsh commands in the Machine section, and powercfg in the User section. Same result; it does not join the network, and after login, no network profiles exist. Additionally, I also tried skipping the network configuration section in OOBE, but that did not help either. Below is what I just tested that did NOT work. Oddly, I noticed when I re-open the Windows configuration after processing it into an ISO, the Wi-Fi-SC.xml file always likes to go in the middle of the two netsh commands (which stay in their proper order relative to each other). Curious... Untitled.png
 
In case it's helpful, here is my Wi-Fi-SC.xml (even though the password is encrypted as alphanumeric gibberish, I've redacted it)
 

Attachments

  • Wi-Fi-SC.xml
    895 bytes
I doubt the WLAN profile is the problem. Either it works or doesn't, but won't create other logged errors.

Back to my previous question, when you're sitting there in OOBE with CMD -- does Windows even have a functioning WiFi adapter, even if it's not connecting to any network?
 
I tried that already, still doesn't work unfortunately.
Try to add it the commands to the windows registry (HKLM-Runonce) instead of Post-Setup.

Have you just dropped the xml file to the Post-Setup?

Probably the issue is the quote after the second % ("%windir%") but as the file and folders names are under 8 characters, there is no need to use quotes.
 
I doubt the WLAN profile is the problem. Either it works or doesn't, but won't create other logged errors.

Back to my previous question, when you're sitting there in OOBE with CMD -- does Windows even have a functioning WiFi adapter, even if it's not connecting to any network?
Here is the output of ipconfig /all in the OOBE after skipping the network join wizard via the option in Post-Setup:

PXL_20221229_011446702.jpg

Mod note: Redacted MAC addresses for privacy.
 
Last edited by a moderator:
Try to add it the commands to the windows registry (HKLM-Runonce) instead of Post-Setup.

Have you just dropped the xml file to the Post-Setup?

Probably the issue is the quote after the second % ("%windir%") but as the file and folders names are under 8 characters, there is no need to use quotes.
Tried removing the quotes entirely, and no difference - still doesn't work. In fact, now I don't have any log output, meaning netsh isn't running at all.

If I can't get Post-Install to do what I need, I may look into RunOnce.
 
I just discovered you and dermitnam both added "/S" to the same command. There is no /S for netsh.
I see. Removed that and tried again; no difference. I will try out the RunOnce method.

Anyway, I realized that sometimes when I compress and reopen my session into an ISO, the order of the commands gets messed up occasionally. Is there a better way to apply my changes to an ISO that doesn't require me to reopen the WIM file?
 
Open "sources\$OEM$\$$\Setup\Scripts\SetupComplete.cmd"

You can edit that file without loading the WIM. When you're done, ask NTLite to create an ISO from the folder (right-menu).
 
Well, I got it to work. Not really sure why %WINDIR% wasn't working, but manually pointing the netsh command to C:\Windows\Setup\FilesU\Wi-Fi-SC.xml worked. I have been encountering a lot of very frustrating bugs in NTLite so far, from the commands I've entered re-ordering themselves upon decompilation, to the commands straight up truncating themselves and becoming malformed. I did not manually edit the SetupComplete.cmd as above; I did this from within NTLite and then recompiled my ISO from there.

Yes, I did put this command back in the User execution queue; not sure if it would work or no in the Machine queue (you would of course have to modify the file path from FilesU to Files). This workaround is not ideal - I always like to program things dynamically rather than hard-coding values in - but it should work. For those of you in the future, the command I'm using (in the User exection queue in the Post-Setup sidebar) is simply:
Code:
netsh wlan add profile filename=C:\Windows\Setup\FilesU\Wi-Fi-SC.xml user=all
 
I wonder if the problem is your user account doesn't exist when "user=all" is called. User Execution runs as you, but still has admin rights.
It's no different from Machine Execution, except it runs much later.
 
Well, I got it to work. Not really sure why %WINDIR% wasn't working, but manually pointing the netsh command to C:\Windows\Setup\FilesU\Wi-Fi-SC.xml worked.

Look at the screenshot, there is "Files" in the folder path, now you point out to "FilesU", twice.
 
When you install, do use an unattended file to create a specific user or wait until OOBE to create one?
 
When you install, do use an unattended file to create a specific user or wait until OOBE to create one?
As you suggested, I was manually creating a user during the Windows install wizard. I'm assuming that's what you mean by out-of-the-box experience in this case. Before, I was creating a user automatically via NTLite.
 
Unattended will create your profile before Post-Setup (Machine) rolls by. I suspect the combination of switching to manual user creation (to check ipconfig /all) and the bogus /S combined to break both cases.

What happens when you go back to Unattended user accounts + (no /S) in Machine execution?
 
Unattended will create your profile before Post-Setup (Machine) rolls by. I suspect the combination of switching to manual user creation (to check ipconfig /all) and the bogus /S combined to break both cases.

What happens when you go back to Unattended user accounts + (no /S) in Machine execution?
Unattended user account + no improper /S flag is the configuration I'm using right now, which is working (though it's in the User execution). The only difference between that and what I have now is my usage of the absolute path instead of the %WINDIR%. I will try again with %WINDIR% as a sanity check, along with it in the Machine execution queue. I've just had to rebase my NTLite ISO for a third time after my USB started BSOD'ing again. It's almost as if I have a limited number of times I can compile and decompile the WIM before it messes things up. It's possible I'm doing something wrong. Thank you for your help thusfar!
 
For best results, always start with a clean ISO and apply your preset. Modding a previous edited image ends up corrupting things.
What you can do is merge multiple working presets into one, and run it on the clean ISO.
 
I don't think the user creation matters for adding profiles, when there is no unattended files, Windows ask to connect to any available WiFi network, before the user creation, Ms is trying to imitate "doodle" to block users from using their devices without logging in.
Tried removing the quotes entirely, and no difference - still doesn't work. In fact, now I don't have any log output, meaning netsh isn't running at all.

If I can't get Post-Install to do what I need, I may look into RunOnce.

I will try again with %WINDIR% as a sanity check. I've just had to rebase my NTLite ISO for a third time after my USB started BSOD'ing again. It's almost as if I have a limited number of times I can compile and decompile the WIM before it messes things up. It's possible I'm doing something wrong.
only edit the unattended file in source \ and setupcomplete.cmd in source \sources\$OEM$\$$\Setup\Scripts
 
Back
Top