Jump to content

Change default gateway by script


Bad boy Warrior

Recommended Posts

Hello all

Looking for a quick solution to this. I want to change the default gateway on all the PCs (running XP) from what it is to another address. I dont think you can do this by GP and unforunately we dont have DHCP setup so i guess its got to be done by script.

Can anyone help here?

Thanks

Link to comment
Share on other sites


Thanks strangely when i get to the

netsh interface>

prompt, it doesnt recongnise ipv4 - but ipv6 s listed when i type "help", kind of lost here

Also i cant run this as a batch script. I think i need something similar to sendKeys so when the script sees Netsh it presses enter to get into the sub text for interface (think SendKeys is for vbs)- maybe im wrong but some guidance needed here.

Thank you

Edited by Bad boy Warrior
Link to comment
Share on other sites

Hey Bad Boy ;)

You can do this using the netsh command. It should be something in the lines of:

netsh interface ipv4 set address "Local area connection" gateway BLAH BLAH :-)

I think you use vista, isn't it ?

For WinXP, I use that code

netsh interface ip set address name="Local Area Connection" static IP MASK GATEWAY
netsh interface ip set dns name="Local Area Connection" static DNS

Replace IP by IP adress of the machine

Replace MASK by mask

Replace GATEWAY by ip gateway adress

Replace DNS by ip of dns

Link to comment
Share on other sites

Hey Bad Boy ;)

You can do this using the netsh command. It should be something in the lines of:

netsh interface ipv4 set address "Local area connection" gateway BLAH BLAH :-)

I think you use vista, isn't it ?

For WinXP, I use that code

netsh interface ip set address name="Local Area Connection" static IP MASK GATEWAY
netsh interface ip set dns name="Local Area Connection" static DNS

Replace IP by IP adress of the machine

Replace MASK by mask

Replace GATEWAY by ip gateway adress

Replace DNS by ip of dns

If your asking me if i use Vista (due to my question from previous post) - then yes and no by that i mean we do have vista but the problem is only relating to xp PCs - heres another twist to the problem these PCs use static IP addresses so i really dont want to touch that part and only the Gateway config - is that possible?

If it is possible do i need to run

netsh interface ip set dns name="Local Area Connection" static DNS

as the DNS config is fine??

Thanks

Edited by Bad boy Warrior
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...