Capturing & Deploying WLAN Profiles

For a long time I have been trying to find a solution for rolling out a standard wireless profile so that anyone with a Laptop can visit any remote site with a WIFI connection and just connect without searching for a new network and without entering a new password everytime.

I stumbled upon the solution the other day whilst trying to solve another problem. If you take a look at this webpage that is on the Symantec Juice website (click here). If you use the file attached at the bottom of the post called WLAN.exe, it will allow you to export an existing WLAN profile saved on your laptop into an XML file. What you can do then do is create a script to import the XML file using the WLAN.exe utility to create the WLAN profile. What I have done is use Altiris to run this script on all client computers, as this process made it very simple to deploy. The script can be found at the end of this blog.

Firstly, you will need to have the WLAN profile already created on your computer. In my case I set-up a test WLAN environment with an SSID of “Test-Wireless” along with a WPA key of “@test-w1rele55!”. Once this was saved, I could use the utility to export the Test-Wireless profile to the XML file (you only need to do this once as long as the settings do not change!). But first, you need to do the following:

You need to find the GUID of your WIFI card, which you can find out by using the WLAN.exe tool and issuing the following command:

WLAN.exe ei
There are 1 interfaces in the system.
Interface 0:
GUID: 4ccd4bf2-4876-4993-a3de-3ed1cdf54eeb
Intel(R) PRO/Wireless 3945ABG Network Connection - Packet Scheduler Mini port
State: “connected”
Command “ei” completed successfully.

You then need to export the WLAN profile for your chosen WLAN network (in this case “Test-Wireless). In the below example you need to pass WLAN.exe your GUID of your WIFI card:

WLAN.exe gp 4CCD4BF2-4876-4993-A3DE-3ED1CDF54EEB Test-Wireless

This then produces the following ouput in the command prompt window:

< ?xml version="1.0"?>
<wlanprofile xmlns=”″>

If you copy and paste the text into Notepad, you will be able to save it as an XML file (call it testwireless.xml).

Now that you have captured your WLAN profile, you are ready to think about deploying the profile. To deploy, test it on your computer. Delete the Test-Wireless network in your WLAN network list, and then issue the following command:

WLAN.exe sp 4CCD4BF2-4876-4993-A3DE-3ED1CDF54EEB testwireless.xml

If you check your list of Wireless Networks, you should find that Test-Wireless should be there along with the WPA key already entered!

That is the manual way of doing it, if you need to automate this amongst a different number of computers you face a problem in that for each computer that requires the WLAN profile, the WIFI GUID will be different on each machine! This did cause me some problems, but after messing with PowerShell for a few hours I managed to create a very simple script that will find the GUID of the machine that you want to deploy the profile to and then pass the GUID to the command line. Here is the PowerShell script to automate this:

$path = "HKLM:\Software\Microsoft\WZCSVC\Parameters\Interfaces\"
$guid = Get-ChildItem -name $path
$guid = $guid.TrimStart(”{”)
$guid = $guid.TrimEnd(”}”)
.\WLAN.exe sp $guid testwireless.xml

And there you have an automated way of deploying a WLAN profile. This will prove to be a great time saver for our IT department & I hope someone will find this useful!


  • pascal commented on March 16, 2009

    did you have a version without powershell ? maybe vb script? powershell isn’t installed on the most clients.


  • Rob Milner commented on March 17, 2009

    Hi, it should be fairly easy to implement the same thing in vbscript (although not as easy as powershell). You should maybe think about rolling out powershell is as it much more powerful than vbscript and it will eventually replace vbscript anyway!

    I will try and work on a vbscript version for you if you like?

  • pascal commented on March 17, 2009

    hey, that would be great. i am a really bad in scripting.

    thx a lot

  • Rob Milner commented on March 25, 2009

    Sorry for late reply – I have just finished the vbscript and the contents of the script is below:

    (Powershell is much easier in this case – its only 5 lines of code compared to 24 lines of code for VBScript!). Hope you get it working anyway…

    option explicit
    Dim wshShell, strComputer, strKeyPath, oReg, arrSubKeys, subkey, command

    Set wshShell = WScript.CreateObject (“”)

    Const HKEY_LOCAL_MACHINE = &H80000002

    strComputer = “.”

    Set oReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\\” & _
    strComputer & “\root\default:StdRegProv”)

    strKeyPath = “Software\Microsoft\WZCSVC\Parameters\Interfaces\”
    oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

    For Each subkey In arrSubKeys
    subkey = Replace(subkey, “{“, “”)
    subkey = Replace(subkey, “}”, “”)
    ‘Used for testing: Wscript.Echo “WLAN.exe sp ” & subkey & ” testwireless.xml”
    command = “WLAN.exe sp ” & subkey & ” testwireless.xml” command, 6, True
    set wshshell = nothing

  • pascal commented on March 26, 2009

    perfect. great work.
    thx a lot

  • Geoff commented on February 15, 2010

    Slight error with the vbscript code there, “set wshshell=nothing” should be the last line, otherwise the script will fail after the first interface (not many systems have more than 1 wifi interface so should be that much of a problem though!)

  • Rob commented on February 15, 2010

    Good point Geoff! VB is no longer my scripting choice – so much easier using PS these days.

  • Niangui commented on May 25, 2010

    Bonjours je viens de trouver ce poste car sa faisait 5 jours que je n’arrivais pas à trouver, il me reste encore des zones d’ambre au niveau d’importation des la connexion, cela se fait avec un bat ou PowerShell, vous demander des copier des fichiers mais ou les mettre est ce que le wlan.exe doit être dans le même dossier que tous le reste
    Merci de pouvoir m’aidé j’en ai besoin

    Hi I just found this post because it was five days I could not find, I still have areas of amber in the import level of the connection, it is with a bat or PowerShell, you ask of copying files or put them but what is the wlan.exe must be in the same folder as all the rest
    Thank you can help me I need

  • Dimple Fleischhacker commented on May 5, 2012

    Say “thanks” you to your parents which they gave you the planet

Leave a Reply

Your email address will not be published. Required fields are marked *