Link to home
Start Free TrialLog in
Avatar of potpourrigroup
potpourrigroup

asked on

VB.NET | Modify line in HOSTS file

Hello! Say I have the following HOSTS file:

192.168.1.1     SERVER1
192.168.1.2     SERVER2
192.168.1.3     SERVER3

Is there a way to change the IP address of line two? Or, if it's easier, remove the line all together and add a new line with the correct IP?

Not sure on the difficulty so I will adjust the points if neccessary.

Thanks Experts!
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Hi  potpourrigroup;

The HOSTS file contains the mappings of IP addresses to host names for TCP/IP.

If the second line is in error just open the file for edit correct the IP address and save the file, then reboot for the changes to take effect.

Fernando
Avatar of potpourrigroup
potpourrigroup

ASKER

Would love to but we have 200 computers we need changed. Looking to script it to save time.
Is line 2 always called SERVER2 or is the IP address always the same as above, 192.168.1.2 ?
The name is the same on all machies...
So the line...

192.168.5.1      SERVER2

This is on all computers but has the incorrect IP address. Need to change the IP or replace the line.

Thanks for your response!
We do run internal DNS but one of our software vendors runs a crappy app that is HOSTS file dependent. That's how all this came about.
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial