Add a wireless profile to your MDT task sequence

First you will need to export the configuration for the wireless profile that you would like to add to your task sequence.
Note: You will need to connect to the wireless profile before you can export it.

:: ADD YOUR WIRELESS PROFILE NAME
SET WIFI-PROFILE="YOUR WIRELESS PROFILE"
:: EXPORT WIRELESS CONFIGURATION
NETSH WLAN EXPORT PROFILE "%WIFI-PROFILE%" FOLDER="%USERPROFILE%\Desktop" KEY=Clear

The export should have copied an XML file to your desktop. In order to keep this simple, go ahead and rename the XML file WirelessProfile.xml. Now, copy WirelessProfile.xml and place it inside of your Deployment Share.
For this example, I will be copying the XML file into a folder called Custom, inside of your scripts folder.

Now go ahead and open up your task sequence and add a “Run Command Line” task inside of the State Restore group.

You can name the task anything you would like but in this example I have named it “Add Wireless Profile”.

Last but not least, you will need to add the following in the Command Line field:

NETSH WLAN ADD PROFILE FILENAME="%SCRIPTROOT%\Custom\WirelessProfile.xml" USER=All

Update (5/2/2018):
There seems to be an issue with running XML files that are not stored locally. If the command to add the wireless does not work, try copying the XML file locally and then running the command.

Now you will have a pre-configured Wireless profile!

5 Comments

  1. Thanks for sharing this. I am struggling to get this to work. I exported the profile from a machine as shown. I inserted the key in clear text. I uploaded the file to the deployment share. I created a run command within the State Restore folder. I specify the path to the file beginning with \\%deploeymentshare%. I have tried various entries in the Start In field: empty, path to profile, path to cmd.exe. I have tried enclosing paths in quotes, and without enclosing. Regardless, I get an error in MDT and the sequence fails at that point. Can you (or anyone reading) help?
    Thanks,

    Jeff

    • Jose Espitia

      May 1, 2018 at 6:54 pm

      I don’t see %DeploymentShare% as an available variable. Try using %Scriptroot% to point to your script folder and place the files in there.

  2. Thanks. Here’s what I have that isn’t working:

    netsh wlan add profile filename=\\CCSD-WDSSVR\MDTDeploymentShare\Scripts\wireless\Wi-Fi-CCSD1-Private.xml USER=ALL

    Start in:
    \\CCSD-WDSSVR\MDTDeploymentShare\Scripts\wireless\

    So, I should not include the full UNC paths?

    • Jose Espitia

      May 2, 2018 at 6:50 pm

      It looks like the command doesn’t like using an XML that is not local. My MDT deployments are usually on a standalone USB stick so I have not seen this issue. Can you try copying the file locally and running the command to see if it fixes your issue?

  3. I got it sorted. The %Scriptroot%. Literally using %Scriptroot%\Path\File did the trick. Thanks for sharing, and for your responses.

Leave a Reply