Wifi Profiles
Posted: 26 Nov 2012 05:11
Hello to all,
i have few different-different ssid for wifi connectivity so i want a wifi profile create script that add profile in wifi network so i have this...
netsh wlan add profile filename=my.xml
Xml file is here:
<?xml version="1.0"?>
<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
<name>my</name>
<SSIDConfig>
<SSID>
<name>ssid</name>
</SSID>
<nonBroadcast>true</nonBroadcast>
</SSIDConfig>
<connectionType>ESS</connectionType>
<connectionMode>auto</connectionMode>
<MSM>
<security>
<authEncryption>
<authentication>WPA2PSK</authentication>
<encryption>AES</encryption>
<useOneX>false</useOneX>
</authEncryption>
<sharedKey>
<keyType>passPhrase</keyType>
<protected>false</protected>
<keyMaterial>wifi</keyMaterial>
</sharedKey>
</security>
</MSM>
</WLANProfile>
my code:
CLS
@ECHO OFF
:MENU
CLS
ECHO -------------------------------------
ECHO ========= WiFi Profile Setup ========
ECHO -------------------------------------
ECHO 1. Setup All Unit WiFi Profile.
SET INPUT=
SET /P INPUT=Please select a number:
IF /I '%INPUT%'=='1' GOTO :Selection1
IF /I '%INPUT%'=='2' GOTO :Selection2
:Selection1
echo <?xml version="1.0"?> >> "wifi.xml"
echo <WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">>> "wifi.xml"
echo <name>my</name> >> "wifi.xml"
echo <SSIDConfig> >> "wifi.xml"
echo <SSID> >> "wifi.xml"
echo <name>ssid</name> >> "wifi.xml"
echo </SSID> >> "wifi.xml"
echo <nonBroadcast>true</nonBroadcast> >> "wifi.xml"
echo </SSIDConfig> >> "wifi.xml"
echo <connectionType>ESS</connectionType> >> "wifi.xml"
echo <connectionMode>auto</connectionMode> >> "wifi.xml"
echo <MSM> >> "wifi.xml"
echo <security> >> "wifi.xml"
echo <authEncryption> >> "wifi.xml"
echo <authentication>WPA2PSK</authentication> >> "wifi.xml"
echo <encryption>AES</encryption> >> "wifi.xml"
echo <useOneX>false</useOneX> >> "wifi.xml"
echo </authEncryption> >> "wifi.xml"
echo <sharedKey> >> "wifi.xml"
echo <keyType>passPhrase</keyType> >> "wifi.xml"
echo <protected>false</protected> >> "wifi.xml"
echo <keyMaterial>wifi</keyMaterial> >> "wifi.xml"
echo </sharedKey> >> "wifi.xml"
echo </security> >> "wifi.xml"
echo </MSM> >> "wifi.xml"
echo </WLANProfile> >> "wifi.xml"
netsh wlan add profile filename=wifi.xml
BUT IS NOT WORKING PLEASE GUIDE WHAT TO DO ??
i have few different-different ssid for wifi connectivity so i want a wifi profile create script that add profile in wifi network so i have this...
netsh wlan add profile filename=my.xml
Xml file is here:
<?xml version="1.0"?>
<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
<name>my</name>
<SSIDConfig>
<SSID>
<name>ssid</name>
</SSID>
<nonBroadcast>true</nonBroadcast>
</SSIDConfig>
<connectionType>ESS</connectionType>
<connectionMode>auto</connectionMode>
<MSM>
<security>
<authEncryption>
<authentication>WPA2PSK</authentication>
<encryption>AES</encryption>
<useOneX>false</useOneX>
</authEncryption>
<sharedKey>
<keyType>passPhrase</keyType>
<protected>false</protected>
<keyMaterial>wifi</keyMaterial>
</sharedKey>
</security>
</MSM>
</WLANProfile>
my code:
CLS
@ECHO OFF
:MENU
CLS
ECHO -------------------------------------
ECHO ========= WiFi Profile Setup ========
ECHO -------------------------------------
ECHO 1. Setup All Unit WiFi Profile.
SET INPUT=
SET /P INPUT=Please select a number:
IF /I '%INPUT%'=='1' GOTO :Selection1
IF /I '%INPUT%'=='2' GOTO :Selection2
:Selection1
echo <?xml version="1.0"?> >> "wifi.xml"
echo <WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">>> "wifi.xml"
echo <name>my</name> >> "wifi.xml"
echo <SSIDConfig> >> "wifi.xml"
echo <SSID> >> "wifi.xml"
echo <name>ssid</name> >> "wifi.xml"
echo </SSID> >> "wifi.xml"
echo <nonBroadcast>true</nonBroadcast> >> "wifi.xml"
echo </SSIDConfig> >> "wifi.xml"
echo <connectionType>ESS</connectionType> >> "wifi.xml"
echo <connectionMode>auto</connectionMode> >> "wifi.xml"
echo <MSM> >> "wifi.xml"
echo <security> >> "wifi.xml"
echo <authEncryption> >> "wifi.xml"
echo <authentication>WPA2PSK</authentication> >> "wifi.xml"
echo <encryption>AES</encryption> >> "wifi.xml"
echo <useOneX>false</useOneX> >> "wifi.xml"
echo </authEncryption> >> "wifi.xml"
echo <sharedKey> >> "wifi.xml"
echo <keyType>passPhrase</keyType> >> "wifi.xml"
echo <protected>false</protected> >> "wifi.xml"
echo <keyMaterial>wifi</keyMaterial> >> "wifi.xml"
echo </sharedKey> >> "wifi.xml"
echo </security> >> "wifi.xml"
echo </MSM> >> "wifi.xml"
echo </WLANProfile> >> "wifi.xml"
netsh wlan add profile filename=wifi.xml
BUT IS NOT WORKING PLEASE GUIDE WHAT TO DO ??