How to Capture and Deploy WLAN Profiles
As PC Transplant is not able to capture WLAN profiles, how can this goal still be achieved?
The following method can be used on Windows XP Service Pack 2 and Service Pack 3.
Requirements for Service Pack 2:
- Download and install Wireless LAN API (KB918997)
Installing this set of application programming interfaces (APIs) will enable you to create applications that can manage wireless LAN profiles and connectivity on Microsoft Windows XP Service Pack 2 (SP2) using the native wireless functionality in Windows, called Wireless Zero Configuration (WZC) service.
- Start the Wireless Zero Configuration service.
Requirements for Service pack 3:
Even though the Wireless Zero Configuration service is set to Automatic, you may find that it is not running, so you will need to start it.
The tool that will allow you to obtain the WLAN profiles as well as deploy them to other machines is called WLAN.exe and is attached to this article.
WLAN.exe has the following command line parameters:
- EnumInterface(ei)
- GetInterfaceCapability(gic)
- QueryInterface(qi)
- SetRadioState(srs)
- GetDriverStatistics(gds)
- Scan(scan)
- GetBssList(gbs)
- GetVisibleNetworkList(gvl)
- SetProfile(sp)
- SaveTempProfile(stp)
- GetProfile(gp)
- DeleteProfile(dp)
- SetProfileList(spl)
- GetProfileList(gpl)
- Connect(conn)
- Disconnect(dc)
- Discover(disc)
- RegisterNotif(r)
- help(?)
Below is the description for each of those commands:
- Command: EnumInterface(ei)
- Description: Enumerate wireless interfaces and print the basic interface information.
- Usage: EnumInterface(ei)
- Command: GetInterfaceCapability(gic)
- Description: Get the capability of an interface.
- Usage: GetInterfaceCapability(gic) <interface GUID>
- Remarks: Use EnumInterface (ei) command to get the GUID of an interface.
- Command: QueryInterface(qi)
- Description: Query the basic information of an interface.
- Usage: QueryInterface(qi) <interface GUID>
- Remarks: Use EnumInterface (ei) command to get the GUID of an interface.
- Command: SetRadioState(srs)
- Description: Set the software radio state.
- Usage: SetRadioState(srs) <interface GUID> <on|off>
- Remarks: Use EnumInterface (ei) command to get the GUID of an interface.
- Command: GetDriverStatistics(gds)
- Description: Get driver statistics.
- Usage: GetDriverStatistics(gds) <interface GUID>
- Remarks: Use EnumInterface (ei) command to get the GUID of an interface.
- Command: Scan(scan)
- Description: Scan for available wireless networks.
- Usage: Scan(scan) <interface GUID>
- Remarks: Use EnumInterface (ei) command to get the GUID of an interface.
- Command: GetBssList(gbs)
- Description: Get the list of BSS.
- Usage: GetBssList(gbs) <interface GUID> [<SSID> <infrastructure(i)|adhoc(a)> <secure(s)|unsecure(u)>]
- Remarks: Use EnumInterface (ei) command to get the GUID of an interface.
- Command: GetVisibleNetworkList(gvl)
- Description: Get the list of visible wireless networks.
- Usage: GetVisibleNetworkList(gvl) <interface GUID>
- Remarks: Use EnumInterface (ei) command to get the GUID of an interface.
- Command: SetProfile(sp)
- Description: Save a profile.
- Usage: SetProfile(sp) <interface GUID> <profile XML file name>
- Remarks: Use EnumInterface (ei) command to get the GUID of an interface.
- Command: SaveTempProfile(stp)
- Description: Save the temporary profile used for the current connection.
- Usage: SaveTempProfile(stp) <interface GUID> <profile name>
- Remarks: Use EnumInterface (ei) command to get the GUID of an interface.
- Command: GetProfile(gp)
- Description: Get the content of a saved profile.
- Usage: GetProfile(gp) <interface GUID> <profile name>
- Remarks: Use EnumInterface (ei) command to get the GUID of an interface.
- Command: DeleteProfile(dp)
- Description: Delete a saved profile.
- Usage: DeleteProfile(dp) <interface GUID> <profile name>
- Remarks: Use EnumInterface (ei) command to get the GUID of an interface.
- Command: SetProfileList(spl)
- Description: Set the preference order of saved profiles. The list must contain all profiles.
- Usage: SetProfileList(spl) <interface GUID> <profile name>+
- Remarks: Use EnumInterface (ei) command to get the GUID of an interface.
- Command: GetProfileList(gpl)
- Description: Get the list of saved profiles, in the preference order.
- Usage: GetProfileList(gpl) <interface GUID>
- Remarks: Use EnumInterface (ei) command to get the GUID of an interface.
- Command: Connect(conn)
- Description: Connect to a wireless network using a saved profile.
- Usage: Connect(conn) <interface GUID> <SSID> <infrastructure(i)|adhoc(a)> <profile name>
- Remarks: Use EnumInterface (ei) command to get the GUID of an interface.
- Command: Disconnect(dc)
- Description: Disconnect from the current network.
- Usage: Disconnect(dc) <interface GUID>
- Remarks: Use EnumInterface (ei) command to get the GUID of an interface.
- Command: Discover(disc)
- Description: Connect to a network without a saved profile. The WLAN service will discover the settings for connection.
- Usage: Discover(disc) <interface GUID> <SSID> <infrastructure(i)|adhoc(a)> <secure(s)|unsecure(u)>
- Remarks: Use EnumInterface (ei) command to get the GUID of an interface.
- Command: RegisterNotif(r)
- Description: Register ACM and MSM notifications.
- Usage: RegisterNotif(r)
- Command: help(?)
- Description: Print this help message.
- Usage: help(?) [<command>]
Here is a basic example of how you can use this tool, once the Wireless Zero Configuration service has been started.
Capture phase:
- Enumerate Interfaces - wlan.exe ei
There are 1 interfaces in the system.
Interface 0: GUID: 89762a5d-bc6b-4ac6-8cf3-b0462b2bafef Intel(R) PRO/Wireless 3945ABG Network Connection - Teefer2 Miniport State: "disconnected" Command "ei" completed successfully.
- Get Profile List - wlan.exe gpl 89762a5d-bc6b-4ac6-8cf3-b0462b2bafef
There are 1 profiles on the interface.
"Profile1" Command "gpl" completed successfully.
- Get Profile (profile name is case sensitive) - wlan.exe gp Profile1
The return profile xml is:
<?xml version="1.0"?> <WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1"> <name>Profile1</name> <SSIDConfig> <SSID> <hex>574C414E2D445341444B</hex> <name>Profile1</name> </SSID> </SSIDConfig> <connectionType>ESS</connectionType> <MSM> <security> <authEncryption> <authentication>open</authentication> <encryption>WEP</encryption> <useOneX>false</useOneX> </authEncryption> <sharedKey> <keyType>networkKey</keyType> <protected>false</protected> <keyMaterial>76A3DEC BA383180E8A18E4E522</keyMaterial> </sharedKey> <keyIndex>0</keyIndex> </security> </MSM> </WLANProfile> Command "gp" completed successfully.
Deploy Phase (setting the profile):
wlan.exe sp 89762a5d-bc6b-4ac6-8cf3-b0462b2bafef C:\Profile1.xml
Conclusion:
As you can see, this tool has many functions, and all of them can be scripted in order to allow you to develop an automated method of capturing and deploying WLAN profiles.
| License: | Altiris EULA By downloading this software, you agree to the terms and conditions in the Altiris End User License Agreement |
| Support: | User-contributed tools on the Juice are not supported by Altiris Technical Support. If you have questions about a tool, please communicate directly with the author by visiting their profile page and clicking the 'contact' tab. |

??
Does this have to be installed on the PC you are going to deploy to? Also is it a new wireless utility or does it just link into the windows one to allow for import/export of wireless profiles?
This is awesome, but...
Good job on this tool. This is going to help me out a lot! One note though, your syntax for obtaining the XML is just a little off. You have to include the GUID in order to get the profile information.
Get Profile (profile name is case sensitive) - wlan.exe gp Profile1
Should be:
Get Profile (profile name is case sensitive) - wlan.exe gp <Interface GUID> <Profile Name>
Thanks again!!
Dewayne
Dewayne Cudney
I automated with a script. Thought it may be helpful.
Configuring WLAN Settings Backup
This has been tested on XP SP3, Vista SP1 and Windows 7. There is a note for XP SP2 on the site that indicates something needs to be installed.
1. Download the wlan.exe file
Download:
http://www.symantec.com/connect/sites/default/file...
Command Switches Info:
http://www.symantec.com/connect/articles/how-captu...)
2. Unzip the file into a directory that you can easily type from a command prompt.
3. Configure your wireless card to the SSID you want to connect to with all the settings you want. (You can configure multiple SSIDs here,
but I did 1 at a time, a more individualized controlled approach)
4. CAPTURE THE GUID:
Run Command (wlan.exe ei)
With Wireless configured, open a command prompt and got to the directory where you unzipped the wlan.exe file, run this command and this will give you the GUID for the
wireless card. Copy the GUID (Only the Hex part) from the command prompt as you will use it for the next steps. The GUID will be unique to each computer. Most computers will have 1 wireless
interface detected in the system. If you have more than 1, this may not work as well.
5. LIST the Currently Configured Profiles:
Run Command (wlan.exe gpl {guid of interface})
This will list the currently configured wireless profiles, the profle name is used for the next part and is case sensitive.
6. CAPTURE the CONFIG:
Run Command (wlan.exe gp {guid of interface} YourSSID > profile.xml)
This will capture the configuration of the wireless info and copy into an xml file that will be used for the deploy/restore. You can name the file anything you want.
I used the SSID as the name for easier identification.
7. EDIT the CONFIG:
Open the profile.xml file with notepad and remove the first and last lines and then save the file. I named the xml files the name of the SSID for easier identification.
1st line will be “The return profile xml is: “
Last Line will be “Command "gp" completed successfully.”
8. SCRIPT the DELPOY:
Now it is time to write the files that will be used for the deploy piece. Follow steps below
8a. **IMPORTANT** ALL files need to be in the same folder when the VBS script is ran
8b. In the folder, create a batch file named create.bat with the wlan.exe ei command in it.
Command to put in the batch file: wlan.exe ei > interface.txt
8c. Copy the wlan.exe and config xml file into the folder
8d. Create a vbs script with the code below. You can name the script whatever you want, again I named it the SSID for Identifications purposes.
Note that profile.xml will have to be named whatever your xml file is and the last line of code can say anything you want.
The Asterisks at the beggining and end of the code snippet are not part of the script, they are markes to show you the code.
********VBS Script Start********
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set MyFile = objfso.CreateTextFile("wlan.bat", True)
Set shell=createobject("wscript.shell")
Shell.run ("create.bat")
wscript.sleep 5000
Set objTextFile = objFSO.OpenTextFile("interface.txt", ForReading)
For i = 1 to 2
objTextFile.ReadLine
Next
strLine = objTextFile.ReadLine
strMid = mid(strLine,8)
MyFile.WriteLine("wlan.exe sp" & " " & strMid & " " & "profile.xml")
MyFile.Close
objTextFile.Close
Shell.run "wlan.bat"
wscript.sleep 5000
set shell=nothing
Set DFile = objfso.GetFile("wlan.bat")
Dfile.Delete
Set DFile2 = objfso.GetFile("interface.txt")
Dfile2.Delete
Wscript.echo "Wireless has been configured!"
********VBS Script End********
9. RUN the SCRIPT:
At this point, you should have 4 files in your folder. Create.bat, profile.xml, wlan.exe, and script.vbs. Run the script.vbs to deploy/build the
profile on the target computer. All settings should be retained and be good to go. I have the script create 2 files during the process and delete them
when it finishes as they are specific to the computer it is ran on.
10. If you have multiple SSIDs you would like to configure, you will have to repeat the process for each SSID. I managed to create 3 different
ones and then put all the files in the same folder and then just run which ever script i need to use to configure. I am sure it could be modified
to do it all from one script, but I did not have a need for that and since the scripts only take a few seconds to run if you had to run multiples,
it would not be the end of the world.
Has anyone been able to get
Has anyone been able to get this to work with profiles that use PEAP authentication? I get the following error message when exporting any PEAP profile:
The parameter for "gp" is not correct. Please use "help gp" to check the usage of the command.
Other profiles work just fine with exports and imports.
Would you like to reply?
Login or Register to post your comment.