Join WiFi networks via script

You need an automated way to join your laptops to WiFi networks, without having to give out the WiFi passcode. 

Use the following method to join your Windows 7+ laptops to your WiFi networks. This can be used on either the K1 or K2 since it it just a batch file (K2 instructions - stay tuned)

  1. From and admin elevated command prompt, export your profiles from a laptop that has already successfully joined the wifi network(s) you want to push out
  1.    netsh wlan export profile key=clear
  1. This will export every profile .xml to the current directory you are in. 
For K1 - Create a new Online Shell Script
For user to run as, I used the local system account, but admin accounts can work as well. 
Attach the profile .xml(s) to your scriptIn the text box, use this command:
  1. netsh wlan add profile filename="INSERT_FILENAME_HERE.xml"
  1. NOTE: Be sure to replace the correct filename
If you have multiple profiles you want ot import, you can add multiple netsh commands all to the same script, as long as they are attached to the script. Change the "script.sh" to "script.bat" so it will work on Windows

Run your script

Now, take your laptop off of the Ethernet connection, and watch as you are automatically joined to your network!

Now that you have this, you can create as many scripts as needed and apply them to various systems using Smart Labels. 


SOURCE/REFERENCE: http://www.windowscentral.com/how-manage-wireless-networks-using-command-prompt-windows-10


  • Thank you for sharing this. Here are a few things to consider too...

    netsh wlan add profile filename="\\server\share\wireless.xml" user=all

    netsh wlan connect wirelessname

    netsh wlan set profileorder name=wirelessname interface="Wireless Network Connection" priority=1

    Use the user=all to make it part of any user who logs in... you'll need to connect the wireless to the interface with the 'connec't comment..

    Also set your profile order, commonly it's 'wireless network connection' but it might be 'wireless network connection 2' or even 'wi-fi' for older systems. With the priority=1 for those profiles that you wish to connect first.. i.e. if you import more than one SSID. - AgentMrQ 7 years ago
  • see the new blog Corey posted with a tool for this now

    http://www.itninja.com/blog/view/export-wi-fi-profiles - SMal.tmcc 7 years ago
    • I actually helped him make that a little bit lol! As i was playing around with this article, he hit me up about making the tool and helped him test it out. Great tool! I love it - brucegoose03 7 years ago
      • it's awesome! Going to save us hours this year imaging classroom laptops - SMal.tmcc 7 years ago
  • This is perfect, exactly what I needed, thank you - for the main post and the comment from AgentMrQ.

    One question - I'm setting this up as a script that will run on a schedule. We're changing our wireless network to a new SSID and I want to stagger it so not everyone gets the script at once. How can I add a Verify step so that this only runs on laptops that don't already have the new network profile? Is there a registry key that I can check if the profile exists, or something along those lines? - nicolebeth 5 years ago
  • Question: What happens if that SSID exists on the machine already? We want to use this to roll out a PW change to our wifi, and probably do so on a regular basis. Will it just overwrite the current SSID info, or will we have to change the SSID to get it to work properly? - teq254 3 years ago
This post is locked
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ