Import WLAN profiles with Powershell (and PDQ Deploy)

If you have multiple sites or as in our case, (construction)sites that come and go, you want an easy way to provide the Wifi keys to your users. Sure you can mail them around, update a list on the intranet. But would it not be convenient to automatically populate the list of WLAN profiles in your users notebooks?

To get this working you only to run the following powershell script:

  1. List the available WLAN profiles on the machine.

    [code]
    netsh wlan show profiles
    [/code]

  2. Then we need to export each profile that we want to distribute to a folder. We set the key to clear, otherwise the user still needs to enter the key. Keep in mind to store the profiles in a protected folder if necessary:

    [code]
    netsh wlan export profile "SSID NAME" key=clear folder="dir_to_xml_profiles"
    [/code]

  3. The last step is to import the WLAN profiles on a (new) notebook. I added a step with this script in my baseline deployment for notebooks.

    [code]
    <pre>$XmlDirectory = "dir_to_xml_profiles"
    Get-ChildItem $XmlDirectory | Where-Object {$_.extension -eq ".xml"} | ForEach-Object {netsh wlan add profile filename=($XmlDirectory+"\"+$_.name)}
    [/code]

6>Thanks to Jan Egile Ring

 

Get more stuff like this

IT, Office365, Smart Home, PowerShell and Blogging Tips

I hate spam to, so you can unsubscribe at any time.

Leave a Comment