Hi, I'm scouring the internet for a solution to this one with no luck. I want to apply a startup VBScript sript to our Windows 2K domain computers via GPO that does the following....
Locates the file C:\WINNT\system32\drivers\etc\hosts
and then edits this hosts file by leaving the current contents of the file intact, but adds the following text
192.168.0.2 server1.domain.com
192.168.0.3 server2.domain.com
then saves the file.
For example,
The "hosts" file before...
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
-----------------------------------------------------------
and now the same "hosts" file after the script has been run....
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
192.168.0.2 server1.domain.com
192.168.0.3 server2.domain.com
------------------------------------------------------------
I can do this manually at the PCs using Notepad to edit the hosts file, but obviously a script will make life so much easier!
thanks in advance to anyone who may take the time to help.
Locates the file C:\WINNT\system32\drivers\etc\hosts
and then edits this hosts file by leaving the current contents of the file intact, but adds the following text
192.168.0.2 server1.domain.com
192.168.0.3 server2.domain.com
then saves the file.
For example,
The "hosts" file before...
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
-----------------------------------------------------------
and now the same "hosts" file after the script has been run....
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
192.168.0.2 server1.domain.com
192.168.0.3 server2.domain.com
------------------------------------------------------------
I can do this manually at the PCs using Notepad to edit the hosts file, but obviously a script will make life so much easier!
thanks in advance to anyone who may take the time to help.