locked
Elevated privileges for MSI Package in Vista. RRS feed

  • Question

  • Hi,

    How does one build in Vista a MSI package with elevated privilege such that UAC dialog pops up asking for user consent to proceed (Allow /Cancel) when the MSI setup is clicked upon?

    I tried using the Orca tool making few changes as mentioned in a number of fourms but to no avail.
    Could anybody guide me in achieving the above mentioned elevation in MSI?.

    Wednesday, January 10, 2007 8:18 AM

All replies

  • MSI installs elevate when necessary when they actually start updating the system, that's when the elevation prompt occurs. There's no elevation during the UI sequence because it's a UI sequence, not a "let's update the system" sequence.  After that you see the elevation. What problem are you trying to solve here?
    Friday, January 12, 2007 10:03 PM
  • My application which I package into a MSI needs to register services onto the registery and copy files (like .mdb etc ) onto the ProgramData folder, Program Files etc when I run my MSI Setup.

    But I am able to register the required services only when I run my MSI from an Elevated Command  Prompt.

    When launched by simply double clicking on the MSI package, even though I get a UAC prompt somewhere in the middle of the installation process, I find that few files are not getting copied into the required location and none of the services getting registered in the CPU  registery.

    How do I solve this issue. I felt that If the MSI package were to be elevated at the initial stage itself as is the case when one installs from an Elevated Command Prompt, the desired outcome would be achieved.

     

    Monday, January 15, 2007 6:38 AM
  • I'm guessing here that you are using custom actions to do these things. The elevation prompt that lets MSI update restricted parts of the system applies to the updates that are directly in the MSI file. It doesn't apply to custom actions, which will run with the non-elevated credentials of the installing user. So anything in your custom action code (installing the service?) will not work because that code is not elevated. One of the ways you can get around this is to launch the MSI from an executable that demands administrator rights with requestedExecutionLevel in the manifest. Other ways around this involve changing the custom action in the MSI file so it doesn't impersonate, but that requires a post-build step and some familiarity with the guts of MSI files.
    Friday, January 19, 2007 11:46 PM
  • I worked around the issue in a slightly different way that may be easier for a Visual Studio 2005 developer.

    In the Setup project I added to my solution, I added a Custom Action that does the necessary file copy functions by calling a DLL.  On the CustomActionData properties page, I added "/ACTION=PRIVILEDGED".  This causes the Setup.exe to be generated with the elevation prompt needed to allow the .MSI process to have the necessary security token, thus allowing the DLL to do its work.

    In the Custom Action DLL, I also added the necessary request for permission as follows:

    Dim f As New FileIOPermission(FileIOPermissionAccess.AllAccess, CopyPath)

    I hope this helps.

    Thursday, March 8, 2007 12:11 AM
  •  Clarker wrote:
    I added a Custom Action that does the necessary file copy functions by calling a DLL. 

    This will almost certainly break in various managed deployment scenarios. You should reserve custom actions only for things that absolutely cannot be done via the standard MSI tables.

    Friday, March 9, 2007 12:50 PM
  • And the hyperlink to the documentation is ?
    Friday, March 9, 2007 4:58 PM
  • The Windows Installer documentation is at http://msdn2.microsoft.com/en-us/library/aa372866.aspx

    It's also worth checking the teams blog at http://blogs.msdn.com/windows_installer_team/default.aspx

     

    • Proposed as answer by Fisnik Hasani Wednesday, October 14, 2009 5:30 PM
    Sunday, March 11, 2007 12:52 AM
  • Hi,

    The MSI and the Windows Installer, elevates automatically in UAC elevation mode.

    The links provided by: AndyCadley are helpful...

    Have a nice day...

    Best regards,
    Fisnik

    Coder24.com
    • Proposed as answer by Fisnik Hasani Wednesday, October 14, 2009 5:30 PM
    Sunday, October 11, 2009 6:29 PM
  • Hi Marimuthu_r:

    How is the situation on your side?
    Is this thread solved?

    Please tell me!

    Have a nice day...

    Best regards,
    Fisnik
    Coder24.com
    Wednesday, October 14, 2009 5:30 PM
  • Hi again:

    How is the situation on your side?
    Is this thread solved?

    Please tell me!

    Have a nice day...

    Best regards,
    Fisnik
    Coder24.com
    Friday, November 13, 2009 8:16 PM
  • Hi again:

    How is the situation on your side?
    Is this thread solved?

    Please tell me!

    Have a nice day...

    Best regards,
    Fisnik
    Coder24.com
    Thursday, November 26, 2009 12:33 PM
  • Hi again:

    How is the situation on your side?
    Is this thread solved?

    Please tell me!

    Have a nice day...

    Best regards,
    Fisnik
    Coder24.com
    Thursday, December 10, 2009 1:56 PM
  • Hi again:

    How is the situation on your side?
    Is this thread solved?

    Please tell me!

    Have a nice day...

    Best regards,
    Fisnik
    Coder24.com
    Sunday, December 27, 2009 9:34 AM
  • Hi again:

    How is the situation on your side?
    Is this thread solved?

    Please tell me!

    Have a nice day...

    Best regards,
    Fisnik

    Coder24.com
    Saturday, January 2, 2010 3:07 PM