Solved

Script to setup wireless connection.

Posted on 2007-11-29
5
3,233 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
[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
  • 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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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…

717 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