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!
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!
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 ?
ASKER
The name is the same on all machies...
ASKER
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!
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!
ASKER
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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