Problem:  How to deploy a wireless profile using MDT so that my laptops add onto the wireless network automatically.

Solution: First you have to export the wireless profile you need.  From a windows device that is already joined to the wireless network, open up a command prompt as administrator and you can run the following command:

   1: netsh wlan show profiles

This will show you a list of wireless profiles currently on the laptop.
Chose the one you want and note the name of it.
In my case the name of the wireless network is “Pretty fly for a WiFi”.

Now I must export this profile to an XML file.  To do this I use the command:

   1: netsh wlan export profile name="Pretty Fly for a WiFi" folder=C:

(UAC TIP:  To save to C: you may need to run the cmd as administrator, otherwise specify another folder)
Now we need to edit the XML file to remove the security. Open the exported XML in notepad.  Find “<protected>true</protected>” and change to “<protected>false</protected>”.  Next, between the “<keyMaterial></keyMaterial>” tags there will be a long alphanumeric string.  Remove this string completely and place in your wireless password.  You should end up with something like this:

   1: <protected>false</protected>

   2: <keyMaterial>[email protected]</keyMaterial>

(NOTE:  Your Wireless password will be in plain text, you may wish to implement more security on this I’m not that bothered)

OK now your XML file is ready for use! All we need to do now is place it in your task sequence.

The next part is personal preference really, I always store my scripts and their dependencies within the Scripts folder of my deploymentshare.  I create a subfolder called “Task_Sequence_Scripts” and place personal scripts and anything they need in there.  My XML file was copied to %deployroot%ScriptsTask_Sequence_ScriptsWireless_ProfilesPretty Fly For a WiFi.xml

I built up a collection of many profiles and store them all in there.   You can now call this to be imported two different ways

Create a new “Run Command Line” underneath “State Restore”.  I generally place it inside the Custom Tasks group under State Restore. Then configure like so:

And that’s it! Give it a whirl and see if it works for you.  Pretty handy if you ask me!