OSD Script to Appent to Hosts file


We have an application that needs IP addresses added to the HOSTS file on the machine to run properly. Since App-V cannot sequence Hosts file we wrote a .vbs to append what we need to the hosts file and added that .vbs script to the OSD file for the application. Now this works for any user who has local admin rights on their machine but fails for any non-admin users so obviously the App-V client is using the credentials of whoever is logged in to run the script. Anyone have any suggestions as to how to have the OSD script to run as elevated rights even if a non-admin user is logged in?


0 Comments   [ + ] Show comments

Answers (6)

Posted by: dunnpy 12 years ago
Red Belt
The correct way would be to get your network setup to correctly resolve the hostname, rather than require an entry in the hosts file - I've not seen an application that actually requires an entry.

Failing that, you could write your vb script could provide alternative credentials to modify the file (google it), but then are you removing the entry with a similar script OSD when the App-V application closes?

Otherwise why don't you distribute an updated hosts file to every machine, with all of the IP addresses you need, using your preferred deployment tool - which will handle the permissions to modify/update/replace the file?

Hope that helps,

Posted by: Jos 8 years ago
White Belt
I'd agree with the first paragraph of Dunnpy's answer, but if you really need to for other reasons (no DNS infrastructure or something) you can fire off a script as SYSTEM when the AppV application is registered. The process is described here:
Posted by: Sirish727 12 years ago
Senior Yellow Belt
I think adding vb script to the osd fille will not work basically we are virtuliasing the application so the application will not modify any thing in the base system.

Better you send vb script sepereatly to the client machines using any software distrubution tools(SCCM,CA DSM)...hope this helps you.

Sirish Kumar K
Posted by: lurims 12 years ago
Senior Yellow Belt
I guess changing the HOST file on the machine just of a particular app to work is not good option. While you sequence the application, try to add a host file in VFS folder. I am not sure this works, as some things a really machine dependent and are the core component of the OS not of application's.
Posted by: kkaminsk 12 years ago
9th Degree Black Belt
I ran into an application with a similar requirement. You must edit the physical copy of the file because the virtual copy won't be seen by the operating system. Ideally the application would not require a custom hosts file but thats life.
Posted by: ksaunam 12 years ago
Orange Senior Belt
Hmm, I wonder.. has anybody really tried hosts -file virtualization? I ask this because I have virtualized services -file in the same location and it worked just fine for the application (SAP Frontend).

Granted, components which uses those two files may be different but maybe in some scenario it could work for hosts file as well?

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ