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 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
[/code]

  • 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]

  • 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]

    Thanks to Jan Egile Ring

    Leave a Comment

    0 Shares
    Tweet
    Pin
    Share
    Share