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


Please log in to comment

Community Chosen Answer

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,

Answered 09/01/2010 by: dunnpy
Red Belt

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


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
Answered 10/14/2010 by: Sirish727
Senior Yellow Belt

Please log in to comment
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.
Answered 10/17/2010 by: lurims
Senior Yellow Belt

Please log in to comment
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.
Answered 10/18/2010 by: kkaminsk
Ninth Degree Black Belt

Please log in to comment
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?

Answered 10/20/2010 by: ksaunam
Orange Senior Belt

Please log in to comment
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:
Answered 12/18/2014 by: Jos
White Belt

Please log in to comment
Answer this question or Comment on this question for clarity