I have to setup a couple of hundred laptops carried by sales folks in the field to connect to a new WPA2-PSK network for work. Fortunately, windows XP has a nice little utility that lets you automate creating a new wireless connection. You’ll need a USB thumbdrive for a little bit to make this work, but you won’t need to distribute it.
- In Control Panel, Run the Wireless Network Setup Wizard and enter in all of your network specifics.
- When prompted, choose the”Use a USB flash drive” Method. Make sure you have a flash drive plugged into your computer.
- Pick the drive letter and hit next, once it has copied the files over, you can just hit cancel and exit out of the wizard.
On your thumbdrive you now have two files (setupsnk.exe and AUTORUN.inf) as well as a directory (SMRTNTKY) with various files in it. If you wanted to, you could distribute this thumbdrive as is and just have people click on the setupsnk.exe to configure their machines. I need to email these settings out, so I did this instead.
- Create a folder, C:\Wireless
- copy those two files and the entire folder into C:\Wireless
- create a batch file called “Install_Wireless.bat” and place it into C:\Wireless
- put the following in that batch file
SET CUR_DIR=%cd%
subst z: “%CUR_DIR%”
chdir /D Z:
Z:\setupsnk.exe
sleep 60
subst /D Z:
The batch file just creates a temp drive (z) that points to C:\wireless, the current executing bat files directory, changes to that drive and runs the setup. setupsnk assumes that it is being run directly from a drive letter, hence the mapping. We wait for 60 seconds after the run and then remove the drive mapping assuming that you were able to click the ok button twice in 60 seconds (the whole process takes like 2 seconds).
Now, just zip that all up and distribute it. The key piece is that everything gets extracted to C:\wireless. I tried the old Relative paths in batch files trick, but it didn’t work for whatever reason and I’m in a bit of a hurry on this one. If anyone can get that part working, you would be teh awesome. I get to claim that awesome sauce. %~dp0 wasn’t working for whatever reason, but %CD% does, so I’ll take it.