Castlewood
asked on
How to add an entry with a condition to hosts file?
I need to write a script to verify if one specific entry "10.1.17.21 server1" exists in the hosts file or not. If yes, do nothing, else insert that entry into the hosts file.
This script will be put in the login script to assure all users with this entry in their hosts file.
Can you help please?
This script will be put in the login script to assure all users with this entry in their hosts file.
Can you help please?
Keep in mind this will need to happen with elevated user permissions on most modern versions of Windows.
~bp
~bp
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
I don't think you can put it in a users login script because hosts may be protected... Unless user is an admin.
You could put it in a gpo in the Startup script, which should work.