Re: Modifying DNS Settings for different subnets

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



quick and easy way would be to run ipconfig via your script and parse the output...
or im sure WMI can get it for you



"William Anderson" <WilliamAnderson@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:55BDC847-5D14-4F15-B147-D39D85B285A5@xxxxxxxxxxxxxxxx
Hey there guys,

I've written a script that installs an application, and the application
requires a specific DNS order for the machines in different subnets. The
problem is that I can't do a global GPO, because not everyone is getting this
software, and laptop users would then have a problem with accessing the
internet when they took it home.

What I need is a script that will check the machines gateway address, and if
it's a certain gateway, then it'll change the DNS settings according to
what's needed.

Example:

If gateway = 192.168.10.1
Then arrDNSServers = Array("192.168.10.2", "192.168.10.3")
ElseIf gateway = 192.168.50.1
Then arrDNSServers = Array("192.168.50.2", "192.168.50.3")
EndIf

If that makes sense...I know how to change the DNS settings for the
machine...it's pulling the default gateway address out of it. Any ideas?

Thanks again!

Best Regards,

.



Relevant Pages

  • Re: Remove Default Gateway
    ... getting the same error with the full script including DHCP ... I can't get the gateway to remove. ... For Each objNetAdapter in colNetAdapters ... >> For Each objNetAdapter In colNetAdapters ...
    (microsoft.public.windows.server.scripting)
  • Re: Changing Gateways for user groups.
    ... connect two remotes sources to the ISA server. ... In the meantime what should i do in active directory to switch gateways between user groups? ... One _ugly_ solution would be to use netsh, creating a script that reads the dhcp values on logon and sets the same values in static except for the gateway, of course there should be a logoff script that sets the nic back from static to dhcp. ...
    (microsoft.public.windows.server.general)
  • Re: Modifying DNS Settings for different subnets
    ... you can get your ipaddress via a vbs script. ... you will get you gateway. ... ElseIf subnet = 192.168.20.1 ... If that makes sense...I know how to change the DNS settings for the ...
    (microsoft.public.scripting.vbscript)
  • always_on.sh script in DD-WRT not working
    ... I have a odd problem with always_on.sh script. ... The problem is that when my modem disconnects, ... gateway address, yet I cant ping google. ... WAN Connection Type: Auto Config - DHCP ...
    (alt.internet.wireless)
  • Re: Is it possible to script static IP assignment?
    ... no script necessary! ... >> if you give your boss 192.168.0.10 with Default Gateway 192.168.0.100 at ... > I am using the free version of SPAMfighter for private users. ... > It has removed 141 spam emails to date. ...
    (microsoft.public.windows.server.scripting)