Solved

Script needed to add a wireless network

Posted on 2008-10-14
11
3,894 Views
Last Modified: 2016-08-29
After searching high and low for something to add a preferred wireless network, along with the WPA key, to multiple XP laptops I found the one on the link below by SirBounty:

https://filedb.experts-exchange.com/incoming/ee-stuff/2326-setupwifi.txt

Only problem is that it doesn't seem to add the network in the script, or one that I edit in, to my list of preferred networks.

I'm looking for a solution to getting a new network along with the WPA key onto about 500 laptops which are scattered around the British Isles.

Am I doing something wrong !? The script runs, opens the wireless config wizard and then it just sits there as if waiting for me to enter details.  The first time I ran it it stayed on the screen for 5 seconds and disappeared.

Code attached.

Cheers any help appreciated.
SSID="MyTestWIC"  'Adjust to read the SSID
Key="abcdefghijklm" 'Adjust to read the key
 
Dim objShell:Set objShell=CreateObject("Wscript.Shell")
 
With objShell
  .Run "control netsetup.cpl"
  wscript.sleep 1000
  .AppActivate "Wireless Network Setup Wizard"
  .SendKeys "%NSN" & SSID & "%MN"
  .SendKeys "%W" & Key
  .SendKeys "%O" & Key
  .SendKeys "%NSN+{Tab}~"
End With
 
Set objShell=Nothing

Open in new window

0
Comment
Question by:johns_ar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 175 total points
ID: 22718392
Hard to say what the problem is - this isn't so much a script as it is a hack...
What it tries to accomplish is an automated walkthrough thru the wireless network setup.
Line 8 was the working delay for that user, you may need to increase it - it's in milliseconds, so that's about a 1 sec pause.

Try manually stepping through the key sequences.
Click Start->Run->netsetup.cpl <Enter>
??How long do you typically need to wait here??
Longer than 1 sec, increase the timer.

Now hit <Alt> + NSN
You should be at the SSID prompt - enter the network name there and press <Alt> MN (to 'manually' setup the key and 'click' next)
Now hit <Alt> W - type the key
<Alt> O to confirm it
and <Alt> NSN then <Tab> and <Space> (to finish).

Does that work?  What changes were needed?

The underlying problem is, like I said, this isn't really a solution script.  Anyone trying to run this to automate the process should be aware (or at least distracted) that it's running because any user interaction while it's running can take away the focus of the network setup wizard and there's no error trapping involved here - the script would simply fail.

If you're aware of that and finding problems with your personal testing anyway, then the steps above should help identify the problem and hopefully a workaround.

Good luck,
~sirbounty
0
 

Author Comment

by:johns_ar
ID: 22718510
Ok cool thanks very much.

I'll give it a try and report back.

Cheers!
0
 

Author Comment

by:johns_ar
ID: 23654380
This solution half worked but someone else came up with a working script that set everything as it should but only on XP SP3...
0
Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

 
LVL 67

Expert Comment

by:sirbounty
ID: 23659593
Are you asking a question?
Haven't heard anything from you in four months, so I'm not sure what you wanted from me here.
I told you upfront this was more of a hack than a solution, but without your feedback and interaction, there's no way for any expert to determine how to help you.
0
 

Author Comment

by:johns_ar
ID: 23664826
Nah I was reporting back saying it was sorted elsewhere.

That hack did work in a fashion, but not as I wanted it to and wasnt really deployable.  Happy to share the script if need be.
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 23664859
Yes please - I'm sure it can help others with similar needs...
Thanx.
0
 

Expert Comment

by:ICANN-EUS
ID: 24791431
any chance you can share that script?
0
 

Expert Comment

by:west-com
ID: 25423171
I would LOVE that script.....
0
 
LVL 4

Expert Comment

by:rsly
ID: 25666700
Agreed. I'd like to see the script as well.
0
 

Expert Comment

by:MCSDexpert
ID: 25762094
I know this has been closed, but in case this can help someone here it goes:

In case anyone needs any help with this to do it with a script, since GP is not always a solution here is how i did it:

Download this tool from Symantec it will work on any brand WLAN NIC:
http://www.symantec.com/connect/sites/default/files/WLAN.zip
On the page there is help with the commands, but this is step by step how i did it:
OK, first we pull the GUID for the machine to pull from:

C:\WLAN.exe ei
There are 1 interfaces in the system.
Interface 0:
        GUID: 8d91c644-2e6b-46e7-b346-82b7b0f787a9
        Intel(R) WiFi Link 5300 AGN - Packet Scheduler Miniport
        State: "connected"

Command "ei" completed successfully.

Next we will use the GUID we pulled(8d91c644-2e6b-46e7-b346-82b7b0f787a9):


C:\WLAN.exe gpl 8d91c644-2e6b-46e7-b346-82b7b0f787a9
There are 2 profiles on the interface.
        "MCSD_802.11A"
        "MCSD"
Command "gpl" completed successfully.

Next we export the settings from the needed profile, in this case MCSD:

C:\WLAN.exe gp 8d91c644-2e6b-46e7-b346-82b7b0f787a9 MCSD>export.xml

On the target machine the GUID must be queried by using the ei command:

wlan.exe ei

once we have the target GUID we can apply the export file to it:

c:\wlan.exe sp NewGuidFromTarget C:\export.xml

This is the process to complete it, a user naamed tomssd on the Symantec forum where this tool is available from created a script to deploy this to multiple machines, and we verified it works.
Good luck!!
0
 
LVL 2

Expert Comment

by:jasenwebster
ID: 25971657
I don't have a vbscript to offer and I know this is under the vbscript forum.  However, vbscript is not the simplest way to do this, which is hard for me to say as I am a vbscript diehard!!  lol

Using wlan.exe mentioned by MCSDexpert above, the following CMD/BAT will added multiple SSID's to a laptop/pc providing the XML is named after the SSID.  See MCSDexpert's post for how to export a config to XML.



@echo off 
echo Grabbing WLAN Interface...
For /F "skip=2 tokens=1,2" %%A IN ('wlan.exe ei') Do If "%%A"=="GUID:" set Interface=%%B 
For %%i in (*.xml) do (
	echo Adding wlan SSID %%~ni
	wlan.exe sp %Interface% %i 
	echo.
	echo SSID: %~ni has been configured!
	echo.
	echo.
)

Open in new window

0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a step by step guide on how to create a basic PTP link using Ubiquiti airOS devices. This guide can be used on the following Ubiquiti AirMAX devices. Nanostation, Bullets, AirBridge, Nanobeam, NanoBridge to name a few. Please review …
This paper addresses the security of Sennheiser DECT Contact Center and Office (CC&O) headsets. It describes the DECT security chain comprised of “Pairing”, “Per Call Authentication” and “Encryption”, which are all part of the standard DECT protocol.
This Micro Tutorial will show you how to maximize your wireless card to its maximum capability. This will be demonstrated using Intel(R) Centrino(R) Wireless-N 2230 wireless card on Windows 8 operating system.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question