I work at in 3 different networks and several days each week I work in
the three (morning, afternoon, night! This are their configurations:
1> Wired LAN with IPs starting with 10.*, static IP, proxy server
2> Wireless LAN with IPs starting with 10.*, with DHCP, no proxy
3> Wired and wireless LAN with IPs starting with 192.*, with DHCP that
always has an IP reserved for my MAC addresses, proxy server
Is there some software that "AUTOMATIZES" the changing
configuration??? I would like something that would change my TCP/IP
configuration for the interfaces that I specify, and the proxy server
for Internet Explorer and Firefox.
Any ideas? Thanks in advance!
I haven't ever (knowingly) used a proxy server, so I can't offer useful
experience there.
For the IP allocation, I've used two approaches:
One approach uses a script for each location: here's the script for one
particular (static) location, changing the Interface called "Local Area
Connection" (it's possible to use wildcard characters, eg "*Area*"):
====================================
echo off
cls
set %n="Local Area Connection"
set %a=192.168.0.251
set %m=255.255.255.0
set %g=192.168.0.1
set %d=192.168.0.1
echo Releasing DHCP...
title Releasing DHCP...
ipconfig /release
echo Setting IP to %a%/%m%...
title Setting IP to %a%/%m%...
netsh int ip set address name=%n% source=static addr=%a% mask=%m%
echo Setting Gateway to %g%...
title Setting Gateway to %g%...
netsh int ip set address name=%n% source=static gateway=%g% gwmetric=1
echo Setting DNS to %d%...
title Setting DNS to %d%...
netsh int ip set dns name=%n% source=static addr=%d%
echo Checking Configuration...
title Checking Configuration...
ipconfig
ping bbc.co.uk
echo Done!
title Done! [%a%/%m%]
pause
====================================
... and here's the script for DHCP:
====================================
echo off
cls
set %n="Local Area Connection"
echo Setting IP to DHCP...
title setting IP to DHCP...
netsh int ip set address name=%n% source=dhcp
echo Setting DNS to DHCP...
title setting DNS to DHCP...
netsh int ip set dns name=%n% source=dhcp
echo Checking configuration...
title Checking configuration
ipconfig
ping bbc.co.uk
echo Done!
title Done! [DHCP]
Pause
====================================
Note: It's possible you may need to include a call to ipconfig /release
early in the DHCP script to avoid any problems with reserved DHCP
addresses. You may also need to change the Interface name (here "Local
Area Connection"). You'd certainly need to tailor these scripts to your
own situation.
The other approach works if you have only one static configuration to
worry about, where there is no DHCP server at _that_ location. You
simply set the interface to pick up an address automatically if it can,
but configure the "Alternate" configuration with the settings for the
fixed setup - when DHCP times out, the system will automatically
configure to the static setup. I've set a laptop up this way for my
most annoying and fault-finding customer, and he's never noticed what's
going on - it just connects.
Turning back to the proxy server issue: I found this article about how
to change settings via script:
http://www.microsoft.com/technet
/scriptcenter/resources/qanda/may05/hey0519.mspx
This would be a *.VBS script invoking Windows Scripting Host, rather
than the DOS-type scripts I quote above. Doubtless you can also do this
in PowerShell.
I've also tracked down a command-line utility (which could be used in a
DOS-type script) called proxycfg.exe, described on this page:
http://support.microsoft.com/?scid=kb%3Ben-us%3B900935&x=13&y=13
Other suggestions I found involved running a *.REG registry script:
http://support.microsoft.com/kb/819961
And, if you're joining a domain at any of the locations, it may be
possible to use Group Policy on the server to set this up centrally.
HTH
Phil, London
Yes you can do it in PowerShell (you can do just about anything in
PowerShell).
http://devpinoy.org/blogs/velocity/archive/2007/06/23
/setting-proxy-settings-in-ie-using-powershell.aspx
Phil
Philip, an option that I found useful was to manually set the network
environment in a specific network and dump the configuration with
netsh dump > customer_1.cmd
Then the generated script can be run the nex time you connect to that
network
Thanks again for your help!
.. and thanks for the tip, which I'd never come across before!
Phil