Skip to main content

Import WLAN profiles with Powershell (and PDQ Deploy)

By April 8, 2023No Comments

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 user’s notebooks?

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

  1. List the available WLAN profiles on the machine
[code] netsh wlan show profiles

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”

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+”\”+$}

Thanks to Jan Egile Ring