add pre defined wireless network info to windows

possibly there is a script already here for this, i didn’t see one. i would like to push pre-defined wireless network info to endpoints. windows 7 or higher 32/64. thus allowing them to connect to pre configured access point

script can set
1.security type
2.encrypt type
3.network sec key

ex:
office x has ap name : xray with key: xyz123 + sec type wpa 2 personal + encry type aes
we can push ssid: xray and key: xyz123 + sec type wpa 2 personal + encry type aes (to our mobile devices group)

having the switch /connect automatically when this network is in range (handy)

I personally think this would be handy for deployment and re configuration scenarios in general.

cheers,

That’s a great idea.

Hi @hytekcomputers

Sure, we will look into your request and update you shortly.

Thanks

Hi @hytekcomputers

We can add a wireless network to the system using import/export profile option available in the windows OS.

  1. Initially, you should export desired wireless network profile from configured system to network or share path. Please try below command with administrator privilege to achieve it,

netsh wlan show profiles - Shows list of wireless profile available in the system

netsh wlan export profile name=“profile-name” folder=“networkpath” - Export wireless profile to mentioned folder path

sample network or share path is “\fileserver.net\Common
etwork”
sample wireless profile is “Wi-Fi”

  1. Now, you can see exported XML file in the network/shared path. Example Wireless Network connection-“profile-name”.xml

  2. Finally, run below script with the correct profile_path variable.


profile_path="\\fileserver.net\Common
etwork\Wireless Network Connection-home-network.xml"

import os
import ctypes
class disable_file_system_redirection:
    _disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
    _revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection
    def __enter__(self):
        self.old_value = ctypes.c_long()
        self.success = self._disable(ctypes.byref(self.old_value))
    def __exit__(self, type, value, traceback):
        if self.success:
            self._revert(self.old_value)

with disable_file_system_redirection():    
    print os.popen('netsh wlan add profile filename="'+profile_path+'" user=all').read()
    print os.popen('netsh wlan show profiles').read()


Let us know your feedback.