Solved

Script to setup wireless connection.

Posted on 2007-11-29
5
3,226 Views
Last Modified: 2010-04-21
I want to script the setup for an XP wireless connection. One script will set the interface to DHCP. The other will setup discrete IP information on the same interface.
0
Comment
Question by:HilltownHealthCenter
  • 3
  • 2
5 Comments
 
LVL 26

Accepted Solution

by:
Pber earned 250 total points
ID: 20377798
First you'll need to get thewireless interface name.  to do that run this from the command prompt:

Netsh interface ip dump

You'll get an output like this:

# ----------------------------------
# Interface IP Configuration
# ----------------------------------
pushd interface ip


# Interface IP Configuration for "Wireless Connection"

set address name="Wireless Connection" source=dhcp
set dns name="Wireless Connection" source=dhcp register=PRIMARY
set wins name="Wireless Connection" source=dhcp


popd
# End of interface IP configuration

The value you are looking for is name="something"
You want the value within the quotes.

Once you have that, replace the "something" with the actual name of your Wireless interface.

Create two batch files and as follows (change the IP, Mask, gateway, DNS and WINS servers to match your network settings)...

Call this batch "Wireless_DHCP.BAT"
@echo off
REM Wireless_DHCP.BAT
Echo Setting Wireless to DHCP
netsh interface ip set address name="Wireless Connection" source=dhcp
netsh interface ip set dns name="Wireless Connection" source=dhcp register=PRIMARY
netsh interface ip set wins name="Wireless Connection" source=dhcp
REM End of Wireless_DHCP.BAT

Call this batch "Wireless_Static.BAT"

@echo off
REM Wireless_Static.BAT
Echo Setting Wireless to Static

netsh interface ip set address name="Wireless Connection" source=static addr=192.168.1.50 mask=255.255.255.0
netsh interface ip set address name="Wireless Connection" gateway=192.168.1.1 gwmetric=0
netsh interface ip set dns name="Wireless Connection" source=static addr=192.168.1.200 register=PRIMARY
netsh interface ip add dns name="Wireless Connection" addr=192.168.1.201 index=2
netsh interface ip set wins name="Wireless Connection" source=static addr=192.168.1.202
netsh interface ip add wins name="Wireless Connection" addr=192.168.1.203 index=2
REM End of Wireless_Static.BAT

Just run the applicable batch file to switch between settings.
0
 
LVL 26

Expert Comment

by:Pber
ID: 20377816
One thing else,

Replace "Wireless Connection" in both batch files to the value of name="something" for the wireless connection for the output of the command: netsh interface ip dump.
0
 

Author Comment

by:HilltownHealthCenter
ID: 20383818
Looks like exactly what I am looking for!    I am a bit fuzzy about what some of  the entries mean.

If I were setting the interface address to . . .50 (as in your example?), then what do the following do?:

netsh interface ip set dns name="Wireless Connection" source=static addr=192.168.1.200 register=PRIMARY
netsh interface ip add dns name="Wireless Connection" addr=192.168.1.201 index=2
netsh interface ip set wins name="Wireless Connection" source=static addr=192.168.1.202
netsh interface ip add wins name="Wireless Connection" addr=192.168.1.203 index=2
0
 

Author Closing Comment

by:HilltownHealthCenter
ID: 31411804
I went to the netsh site, to figure out the syntax and meaning. Works like a charm. Thanks Pber!
Man I love this site!
0
 
LVL 26

Expert Comment

by:Pber
ID: 20404853
Sorry for note getting back to you.


These settings set your DNS records:
netsh interface ip set dns name="Wireless Connection" source=static addr=192.168.1.200 register=PRIMARY
netsh interface ip add dns name="Wireless Connection" addr=192.168.1.201 index=2

...the index=2 sets the secondary server.  If you only have one dns server, the second entry can be deleted.
If you don't have any dns or wins servers, the respective entries are all optional.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Cisco Air-Cap26021-A-K9 -- controller - stand alone question 3 57
Cisco Air AP 6 41
Wireless antenna advice/design 6 48
Internet problem with a router wifi in our iPhone 31 78
Sometimes people don't understand why download speed shows differently for Windows than Linux.Specially, this article covers and shows the solution for throughput difference for Windows than a Linux machine. For this, I arranged a test scenario.I…
DECT technology has become a popular standard for wireless voice communication. DECT devices are not likely to be affected by other electronic devices and signals because they operate in a separate frequency-band.
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…

919 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

20 Experts available now in Live!

Get 1:1 Help Now