Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

How to Capture and Deploy WLAN Profiles

Created: 20 Feb 2009 | 34 comments
Language Translations
SK's picture
+5 5 Votes
Login to vote

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:

  1. 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.

  2. 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:

  1. 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.
  2. Get Profile List - wlan.exe gpl 89762a5d-bc6b-4ac6-8cf3-b0462b2bafef

    There are 1 profiles on the interface.

    Command "gpl" completed successfully.
  3. Get Profile (profile name is case sensitive) - wlan.exe gp Profile1

    The return profile xml is:

    <?xml version="1.0"?>
    <WLANProfile xmlns="">
    				<protected>false</protected>				<keyMaterial>76A3DEC BA383180E8A18E4E522</keyMaterial>
    Command "gp" completed successfully.

Deploy Phase (setting the profile):

wlan.exe sp 89762a5d-bc6b-4ac6-8cf3-b0462b2bafef C:\Profile1.xml


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.

Comments 34 CommentsJump to latest comment

spazzzen's picture

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?

Login to vote
dcudney's picture

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 Cudney

Login to vote
tomssd's picture

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
Command Switches Info:

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)
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.

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.

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.”

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("") ("create.bat")
wscript.sleep 5000

Set objTextFile = objFSO.OpenTextFile("interface.txt", ForReading)

For i = 1 to 2

strLine = objTextFile.ReadLine
strMid = mid(strLine,8)

MyFile.WriteLine("wlan.exe sp" & " " & strMid & " " & "profile.xml")
objTextFile.Close "wlan.bat"
wscript.sleep 5000
set shell=nothing
Set DFile = objfso.GetFile("wlan.bat")
Set DFile2 = objfso.GetFile("interface.txt")
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.

Login to vote
akoutsouradis's picture

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.

Login to vote
Pigeo's picture

(Tested under Windows XP)

If you try to export a profile that uses PEAP (or other kind of EAPs) authentification, it displays the following error message : The parameter for "gp" is not correct. Please use "help gp" to check the usage of the command.

Here's a trick I've found : 

1) open regedit and go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\EAPOL\Parameters\Interfaces\{your_interface_GUID}\ : Here you'll find different entries, numbered sequencially from 1 to XXX. Double click on each of these entries in order to display their content in a readable form. Locate the entry where your profile name is mentioned somewhere in the beginning of the binary date (there should be only one entry in this case). Export this entry in a .REG file. Note : the entry name (which is a number between 1 and 99) has no importance at all : you can safely give it any number from 1 to 99. So, in order not to overwrite another existing profile on another computer, let's rename it 99.

2) modify your profile before exporting it : go to profile properties, tab "authentification", and as EAP type, choose "Smartcard or other certificate" (sorry if translation is bad... I'm on a French version of Windows) then OK.

3) export your modified profile. Since it no longer uses a PEAP, you can export it without error message.

4) import the modified .REG file in order to restore your wifi profile to its original EAP type settings.

5) optionnal : You can reopen Wifi Profile settings in order to check that the EAP type settings has been correctly restored by the importation of the .REG. If it's not the case, don't panic: it may require some reboot or service start / stop or importing a profile with WLAN so that the "new" parameters are taken into account.


To import the profile on another computer :

1) import the modified profile using WLAN.exe

2) then, import the modified .REG in order to restore the EAP type settings

3) Maybe some reboot or service start / stop or importing another profile using WLAN is required in order to "update" and so that new parameters are taken into account by Windows (though I'm not sure if this is actually required)

Login to vote
GarryShape's picture

I run into a problem with this method.

After you import the profile with WLAN.exe, it creates a wireless REG_BINARY entry in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\EAPOL\Parameters\Interfaces.

So now when you import the reg file, it doesn't replace the registry entry, it adds yet another REG_BINARY for the same wireless network. So you still have to delete the generated REG_BINARY item that came after the WLAN import, and then your EAP type settings will take effect immediately. 

How would one even automate that? 

Login to vote
jaylweb's picture

Seems very sloppy to call batch files to launch a command line application for a vbscript.  Yes it works, but can be much simpler with a single batch file instead of two batch files and a vbs.  Not to mention, you can parse the output of wlan.exe ei using the For /F command without creating a temporary text file.

Here is what I created.  Name the BAT after your SSID and you won't have to edit this script at all. (%~n0 calls the BAT name without the extension)  The echo statements are optional, but makes it nice to know what is happening.  The pause script is optional as well depending on how you plan to deploy. 

Save the following as a BAT or CMD file.  Do not copy the lines with asterisks. 

********BAT Script Start*******
@echo off

echo Grabbing WLAN Interface...
For /F "skip=2 tokens=1,2" %%A IN ('wlan.exe ei') Do If "%%A"=="GUID:" set Interface=%%B

echo Adding wlan SSID %~n0
wlan.exe sp %Interface% %~n0.xml
set Interface =

echo SSID: %~n0 has been configured!
********BAT Script End*******


Login to vote
jaylweb's picture

This BAT/CMD is simpler.  You only need to place this BAT in the same folder as your XML's.  Make sure the XML's are named after the SSID.  This BAT will add all SSID's (the XML's) to your wireless card.  The BAT file can be named to whatever you like.  

********BAT/CMD Script Start*******
@echo off

echo Grabbing WLAN Interface...
For /F "skip=2 tokens=1,2" %%A IN ('wlan.exe ei') Do If "%%A"=="GUID:" set Interface=%%B

For %%i in (*.xml) do (
    echo Adding wlan SSID %%~ni
    wlan.exe sp %Interface% %%i

    echo SSID: %~ni has been configured!
********BAT/CMD Script End*******


Login to vote
Frank019's picture

Thanks that could be very useful

Login to vote
beach's picture

Hi there,

This looks like the exact same program as the WindowsSDK sample for the WirelessAPI.  In which case at the top of the source code it's copyrighted by Microsoft.

Just thought people should know if they are using it for something other than personal use. 

Login to vote
SK's picture

The download link for the tool is a Microsoft link so anyone who uses this tool will know that it belongs to Microsoft.


Connect Etiquette: "Mark as Solution" those posts which resolve your problem, and give a thumbs up to useful comments, articles and downloads.

Login to vote
perrin_wolf's picture

THANK YOU  jaylweb, and tomssd.  As a scripting newbie seeing both methods was very helpful.

the script is working great, and with PEAP Authentication, using a PKI cert.

Login to vote
CCavazos's picture

When I try to import the profile I get an error, "The given profile is not vaild."  I created the profile several times using the method described above and I still receive the same error.  Has anyone else experienced this?

Login to vote
cmacrun's picture


Did you open the XML you exported and remove the first and last lines, making it a valid xml file?  I missed this step at first but once you edit the xml, you should be good.

Login to vote
mike_plichta's picture

I've got an HP 4415s laptop that fails on the gp export step.  I was able to get it to list the profiles so I know I have the GUID typed in correctly.  If I ask for the settings from the ssid (it's all numbers so there is no case sensitivity problem) it throws the error in the subject line.  If I ask for an SSID that doesn't exist, it gives a different error code 1168.  

This is a broadcom 4322AG card a/b/g

Login to vote
campbellm's picture

Not having any luck setting the profile order using wlan spl <GUID> <profile name>+

I have tried many variations and the syntax is not entirely clear. Do you enter each profile name, in the order you want them, separated by a + sign ? I've tried everything I can think of, something is missing.

Login to vote
jaylweb's picture

This utility is available by download from Microsoft,s site.  If there were a licensing issue, it wouldn't be freely available to the world for download. 

I don't believe you can enter multiple profiles in the way that you are trying.  You can import using only one xml file at a time.  The examples that I provided were using an XML file for each profile and basically using wlan to import them one at a time.  I believe you can import multiple profiles using one XML file, including the preference order.  It has been a while since I was using this utility, so you'll have to test it out and play with it.  If you still have problems figuring it out, then I might be able to help you on Monday.

Command: GetProfileList(gpl)
Description: Get the list of saved profiles, in the preference order.

I'm not even sure how what command and parameters you are running that generates the error.  I'm guessing it is some sort of syntax error?  What OS are you running? A little more insight might help me to help you.  :)

Login to vote
campbellm's picture

I figured out how I'm going to handle the profile order using the batch file example by numerically numbering my profiles so that they are process in the order I want.

What I'm running into though is that if a machine has multiple wireless adapters, the batch will only process the GUID for the first adapter it parses. I'm trying to figure out how to batch this so that it will loop through and process the profiles for each wireless adapter until all GUID parsed have had profiles created.

Login to vote
jaylweb's picture

Try something like the following batch file.  It is similar to what I posted earlier, except that the next For loop runs within the first.  This way, it will run for each GUID that it finds. 

********BAT/CMD Script Start*******
@echo off

echo Grabbing WLAN Interface...
For /F "skip=2 tokens=1,2" %%A IN ('wlan.exe ei') Do (
    If "%%A"=="GUID:" (
        For %%i in (*.xml) do (
            echo Adding wlan SSID %%~ni
            wlan.exe sp %%B %%i

        echo SSID: %~ni has been configured!
********BAT/CMD Script End*******

Login to vote
JuliusPIV's picture

I'm looking for a solution like this for Windows 7 as I'm trying to find a way to deploy or automate the process of adding pre-configured wireless profile.  Although I successfully exported the profile from a previously configured machine via
netsh wlan export profile name="company-network" folder="H:\wireless-profile"

When I import the profile using netsh, it does not include the WPA2PSK TKIP key.
netsh wlan add profile filename="H:\wireless-profile\weth0-company-network.xml" user=all

So I decided to try my hand at creating a GPO (Computer Configuration > Windows Settings > Security Settings > Wireless) by importing the XML file created above, but when I import the XML above, I receive a "The Network Key has been removed from this profile" message.  This happens even when I set <protected>false</protected> and include the key unencrypted (<keyMaterial>UNENCRYPTED</keyMaterial>)

Lastly, I'm aware that Windows allows one to copy an already configured wireless profile to a USB flash drive, but its my understanding that the `setupSNK.exe` that gets created doesn't accept any of the standard silent/quiet switches.  Furthermore, the file won't even launch when its not run from a flash; it simply doesn't launch or it launches and immediately quits.

How can I silently deploy a pre-configured wireless profile?
Can this be done via VBScript or PowerShell?
Or am I forced to use something like zwlancfg?

Login to vote
phil26271's picture

Julius, did you find a solution to reploying pre-configured wireless settings ?  Thanks.

Login to vote
mtroelsen's picture

Hey all

just found out how to import a profile into a Windows 7 machine using the netsh wlan built in command line tool, based on the experiences I had with the article posted here.

Unfortunately, it is not completely hassle free. A little background story:

After testing for some time, I found that exporting and importing a profile using the netsh wlan command, built into Windows vista and upwards, works fine when you do it on the same machine. However, take that very same XML file over onto another pc, and it won’t work... the passphrase simply doesn't get imported.

With this in mind, I looked at the old XML file made using the WLAN tool from this article, and i found that the only difference is in the sharedkey section at the bottom. The main difference was that the key exported using the tool from this article was a "networkKey" keytype, the keytype of the one exported using the built in tool in Windows 7 was "passphrase". This got me thinking...  What if I took the whole sharedkey section from my XML file generated by the WLAN tool in Windows XP... would that work?

The answer.... is YES! It did!

For some odd reason, the encryption algorithm for Windows 7 for the wireless profiles is so weird that its key is restricted to that one machine.

Answer to your prayers is the following

1) Download the WLAN tool from this article onto a Windows XP machine with your wireless profile already set up
2) Export the profile into a XML file using the guide from this article. Notice that the sharedkey section should say "networkKey" as keytype and it says false in protection.

3) Import the XML file into your Windows 7 machine using the following command

netsh wlan add profile filename="c:\my wireless key\wirelesskey.xml"

And that’s basically it!

Since netsh is a built in command in Windows 7, there is a ton of ways to automate it for your domain.yes

 Happy WLAN deploying! smiley

Login to vote
jaylweb's picture

mtroelsen, that is a great find!  Did you find a way to export from a Win7 and import into another Win7?  Your method for exporting from WinXP and importing to Win7 is sound.  But I think Win7 to Win7 will be the next evolution.  laugh

Login to vote
mtroelsen's picture

Hey Jaylweb

Unfortunately no, but i haven't given up yet. Everything is possible...

One added "bonus" to doing it the way i described (importing the profile from XP into Win7), is that if you try to have a look at your wireless key (in the profile settings itself, go to the "security" tab), it will show as ew9ijwe9fjw9+efjw+e9f8jw+e9fjw9+efj or whatever your key was previously encrypted into in Windows XP. This however posts a new challenge... since what im ultimately interested in is having a XML file on my network for deployment, which users cant read anything in, should they intercept the file.

I will give an example on this

The XML file i currently have from XP (the one that works for importing in Win7), shows the following settings under the "sharedkey"  section:

keytype = networkkey
protected = false
keymaterial = 26BAD0FE231492A42F2C51D51DA1F272184E150

Lets say my cleartext password for the network is "myhorseisapony", then that keymaterial would resemble a "encrypted" version of it. BUT for some odd reason, the "encrypted" key ALSO works if you punch that in while connecting... this is... uhm... rather not good :) It would mean that if my users got a hold of the XML file it might as well say the password in cleartext. So.... this means i am one step closer to the ultimate solution, but not quite there yet. At least now we can deploy the profile.

EDIT: The keymaterial from the Windows XP export is hex code! How did i not notice that at first :) Maybe this can point me towards something.

For good measure, should you want to contact me for any reason, i can be reached at support AT madstroelsen DOT dk (replace the AT with @ and the DOT with .)

But otherwise trust me... as soon as i know, YOU guys will know :)

Have a great week all

Login to vote
cobmsdn's picture

1.) Configure an SSID & export using an XP workstation as described earlier.

2.) Create a PowerShell script with the following code:

- - - code - - -
[array] $interfaces = & "C:\Temp\wlan.exe" ei;

foreach ($item in $interfaces) {
     if ($item.Trim().Contains('GUID:')) {
          [string] $guid = $item.Trim().Substring(6);

          Write-Host "Adding SSID: 'MySSID'";
          & "C:\Temp\wlan.exe" sp $guid "C:\Temp\Source\MySSID.xml" | Out-Null;
- - - code - - -

Login to vote
mtroelsen's picture

Finally! After much blood, sweat and tears... here is a viable way to export from Win7, and reimport into Win7.

Took me some time to find, but here is the official documentation from Microsoft about their whole programming library for WLAN profiles:

What I basically found out from that site, is that the only way for you to import a wireless profile from one PC to another PC (possibly of a different make and model), is to have the passkey unencrypted in the XML file. You can read it at the bottom of this page:

So... the way to export is this way:

netsh wlan export profile name="my first wireless" folder="c:\wireless" key=clear

That string, produces an XML file, where the sharedkey section should say keytype=passPhrase , protected=false and keyMaterial= your unencrypted wireless key

This XML file, is good for being imported to whichever Win7 machine you want to use it on. Just remember that the wireless key is stored unencrypted, and take appropriate measures towards not sharing this XML file with all your users (if you want to keep it secret).

Next, the way to import the same profile again is this:

netsh wlan add profile filename="c:\wireless\myfirstwireless.xml"

Just remember, if you want to export the profile without needing to change anything in it, use my above export string. If you don’t type in key=clear at the end, the key will be encrypted, and you won't be able to import it again on another PC other than the one you currently exported it from.

Login to vote
NoJacket31's picture

Am getting errors when i try to capture a profile with WPA2 security but it okay when i capture WEP security profile. Can capture successfully on Windows 7 without a problem but my problems are on Windows XP with SP3. Has anyone come across this error in the subject line....

Login to vote
jaylweb's picture



Another user had posted that same error and I had suggested it might have been a syntax error, but they never responded.  Can you copy/paste your syntax for us to see?  That would be helpful.  Also, is the key all numbers?  Curious since the prior person mentioned thier key was all numbers.  I'm not sure what the smoking gun is yet, but we can help you figure it out.  :)



Login to vote
bobhoskins's picture

jaylweb - awesome stuff, great script. I've tested the xp one, works fine. Just about to test on SP2 also...hoping that we don't have to insall anything but i take your earlier comment on that.

Will be testing the Win7 one at some point as well but it looks like you've cracked that one also.

Really good stuff for the community well done - BOOKMARKED!

Symantec don't you dare lose this page....

Login to vote
bobhoskins's picture

Nah SP2 does require that KB article referenced and the required patch installed. Runs fine after that. Next test, Win7! We've got em all you see....:)

Login to vote
rustychiles's picture


I needed to automate wlan profiles post-os deployment in systems with a single WLAN card and some of the batch examples didn't seem to work for me so I came up with this to find the GUID then deploy my settings. If it helps anybody else I figured i'd share. 
For /F "tokens=1-2*" %%A IN ('wlan.exe ei ^| find "GUID:"') do set WLGUID=%%B
wlan.exe sp %WLGUID% wlan.xml
Login to vote
gagaduckula's picture

I've got a profile xml file from Win7

It's normal if I use netsh wlan in Win7.

How can I use it in WinXP for wireless setup?

It looks to use command wlan conn <interface GUID> <SSID> <infrastructure(i)|adhoc(a)> <profile name>

However I am not sure what's the infrastructure|adhoc mean.

Anyone could teach me??

Thanks a lot.

Login to vote
jlawson's picture

Looking through this article because I now need to start getting a method for Windows 7.  I have always used AutoIT in xp to deploy my wireless setup but this does not work in Windows 7.

First I would like to suggest everyone please vote up this idea:

Login to vote
questorfla's picture

i have the complete and working batch file for using XML and it works to export as well as import.


I have yet to test on cross/system.  This is tested only on my own laptop.  Export/ Delete/ check to make sure not there/ import from XML


Works fine.  But.  This, as you say, is not worth anythign it it wont cross/system deploy.

Plus XML files (as well as rthe WFC file created when you use the windows 7 built in export for import to new system) are both plaintext.  Not good.

Has anyone looked at doing a registry export?  I ran acroos (by accident) the location of these keys one day when I was trying to totally TOTALLY remove some mapped network drives.  Windows 7 refuses to "forget" the path even when disconnected for weeks.  The drives will even remap to a new IP but the IP shown in the COMPUTER display more than not shows the OLD IP even thougfh it is connected to a NEW IP.

This is a compltely different problem I am working on as well but this deployment of WIFI profiles I need to get done ASAP.

Thanks for any input

I tried to allow replies to my posts if it doesnt work I will send my email address to you

Login to vote