Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > How to get Administrator previleges during Installation with custom action
 

How to get Administrator previleges during Installation with custom action

hi, i have build .net form application which requires Java Runtime Environment (JRE)
i'm trying to create an installer which will do some actions as described below

- install the
Java Runtime Environment (JRE)
- copy some file to the JRE installed folder.

my issues are

if the client has no administrator privilege, the client needs to right click the installer and select the run as menu and enter the administrator username and password right? now how can i get the username and password to be used in the custom action?? because i need them to install the JRE and do the copy thing.

or any other way to achieve this?


regards, Tris Setiawan.



Tris Setiawan  Thursday, November 27, 2008 4:24 AM

Hi Tris Setiawan,

Welcome to MSDN.

First I wonder why your .net application need Java Runtime Environment?

Second, once you right click the setup file to run as administrator, your code will have administrator privilege to do some action such as copying files to a special folder. But since MSI does not allow to start another process during installation, so the installer won’t allow you to install JRE.

If I misunderstood your meaning, please feel free to tell me.

Sincerely,

Kira Qian

Kira Qian  Friday, November 28, 2008 8:07 AM

Hi Tris Setiawan,

Welcome to MSDN.

First I wonder why your .net application need Java Runtime Environment?

Second, once you right click the setup file to run as administrator, your code will have administrator privilege to do some action such as copying files to a special folder. But since MSI does not allow to start another process during installation, so the installer won’t allow you to install JRE.

If I misunderstood your meaning, please feel free to tell me.

Sincerely,

Kira Qian

Kira Qian  Friday, November 28, 2008 8:07 AM
You can't get hold of somebody's password, so you can't do this. What problem are you trying to solve? Why do you need somebody else's password?

PhilWilson  Monday, December 01, 2008 6:42 PM
I havethe same issue. because we have quite often customized file other than executation file, like customer image or template. the execute file is quite stable, two three months a new release.I create a custom action in msi file. the custom action xcopy some setting and customized file into install folder under programm file. which works fine in XP. but in vista and windows 7, we find that xcopy fail to work if not running as adminstrator.
is it possible to take the administrator right to the custom action in msi. or I need to write a DLL instead of directly use xcopy?

thanks.

Dave
ImprintPlus  Wednesday, June 10, 2009 12:23 AM

You can use google to search for other answers

Custom Search

More Threads

• RemotingConfiguration.Configure does not Work with Web Deployd Applications
• Publish options broke Window Form assembly build
• Publish.htm differences between VB 2005 & VB 2008
• MSI and ClickOnce together
• Launch ClickOnce App As Child Window
• Install registry entries over LAN
• Click Once Publish Version is not remembered in Source Safe
• Wrong dll called because InprocServer32 data in registry
• CustomActionData double quotes
• Dynamically add folder to setup and deployment project