Solved

Script needed to add a wireless network

Posted on 2008-10-14
11
3,866 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
11 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 175 total points
Comment Utility
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
Comment Utility
Ok cool thanks very much.

I'll give it a try and report back.

Cheers!
0
 

Author Comment

by:johns_ar
Comment Utility
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
 
LVL 67

Expert Comment

by:sirbounty
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 67

Expert Comment

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

Expert Comment

by:ICANN-EUS
Comment Utility
any chance you can share that script?
0
 

Expert Comment

by:west-com
Comment Utility
I would LOVE that script.....
0
 
LVL 4

Expert Comment

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

Expert Comment

by:MCSDexpert
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Working settings for French ISP Orange "Prêt à Surfer" SIM cards for data connections only. Can't be found anywhere else !
Using in-flight Wi-Fi when you travel? Business travelers beware! In-flight Wi-Fi networks could rip the door right off your digital privacy portal. That’s no joke either, as it might also provide a convenient entrance for bad threat actors.
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now