Hmm, since I’ve gotten quite a few PMs about this since I posted this, I’ll come clean. However, I quit the job I was working at so I don’t have the functional code written down any more, so I’m attempting to compile it by memory here.
First things first: I owe all credit to this guide from Symantec. All the tools and commands you’ll need are in there. Secondly, I’m not a professional programmer, so I’m probably going to mix things up a bit. Thirdly, you’ll probably need to fiddle with it a bit to make it work - I don’t have the original code I wrote and I don’t have an XP workstation any more to test it out on.
Preliminary note for people running XP SP2: You’ll need to download and install this: Wireless LAN API (KB918997). Then start the Wireless Zero config service. It’s supposed to auto-start after a reboot, but it’s wonky. It’s also worth your time in SP3 to make sure that Wireless Zero configuration service is running.
Preliminary note - tools needed: XP doesn’t come with its’ own set of Wireless Interface commands, which is why this is such a bother in the first place. You’ll need to download this tool, developed by Symantec, and run your commands through them. Home - Broadcom Community - Discussion Forums, Technical Docs, and Expert Blogs
If you’re making this as a tool to be run off a memory stick, I suggest putting it in the root folder of the memory stick. Otherwise, keep everything in one folder somewhere you can find it, like your desktop.
Let’s get started:
1. Step one is to set up your Windows XP machine with the network you want to save and distribute. Make everything like it’s supposed to be. If your users will all be using their own set of passwords, remember not to enter your own username and password first. Just basically get it all set up the way you want your users to experience it. Delete every other wireless profile except the one you want to distribute in order to avoid confusion later.
**2. **Step 2 is aquiring the GUID of your network card. Open a command prompt in the folder where you unzipped the WLAN.exe file you downloaded from above and enter the following code:
wlan.exe ei
The above code will give you a return of the WLAN interfaces in your system. Write down the GUID for your wireless network card in notepad. (If you have multiple, or get false positives, experiment by disabling them one after one until you’re sure you know the right one.) The return might look something like this:
Interface 0: GUID: 89762a5d-bc6b-4ac6-8cf3-b0462b2bafef Intel(R) PRO/Wireless 3945ABG Network Connection - Teefer2 Miniport State: "disconnected" Command "ei" completed successfully.
You want the string behind “GUID:”
Step 3.
Step 3 is getting the profile list from the network card we isolated earlier. This is done by entering the following code:
wlan.exe gpl YOURGUIDNUMBERHERE
From Symantec’s example GUID above we get the following return:
"Profile1"
Command "gpl" completed successfully.
For further reference, please note that the profile name is case sensitive.
**Step 4:
**In this step we aquire the network profile itself and save it to a .XML file. However, note that there is an error in the Symantec guide’s code. Their code would be:
wlan.exe gp Profile1
The correct code is:
wlan.exe gp YOURGUIDNUMBERHERE Profile1
But, if you have no need to read the XML itself, you can just use the following command to save it to a file instead, which is what you’ll need to do later anyway.
wlan.exe gp YOURGUIDNUMBERHERE Profile1 > C:\Wireless\Profile1.xml
Aaaaaand you’re done. You now have a saved copy of your wireless settings. In order to test it, delete your current network profile from your wireless and make sure you can’t connect to the internet. Then use the following command:
wlan.exe sp C:\Wireless\Profile1.xml
(You’re probably thinking of the lack of the GUID number in the import code. Don’t worry; if you don’t specify it, Windows will add it to all interfaces.)
That should work. Get back to me if it doesn’t, maybe I can remember something else.
I know there are probably more elegant solutions to this, using all kinds of fancy tools, but I just cracked together this with batch. Anyone has a better solution - for XP, mind - I’d be glad to hear it.
Now, in the PM, you also asked how to make it select by which OS you have. That part’s simple, just use the VER command to detect the OS and then use “if VER x goto” the part of your batch file which contains the appropriate command to set the network profile.
Good luck! As I said, it might take some fiddling, but it does work.