Reply to Thread

Post a reply to the thread: How to run just installed program as administrator one time

Your Message

Click here to log in

What's the name of our main installation product (in uppercase letters), directly followed by the current year?

 

You may choose an icon for your message from this list

Additional Options

  • Will turn www.example.com into [URL]http://www.example.com[/URL].

Topic Review (Newest First)

  • 06-25-2013, 02:05 AM
    linder

    Re: How to run just installed program as administrator one time

    Hello,

    Do you need any further help with this?

    Thanks,
    Friedrich
  • 06-24-2013, 12:08 AM
    linder

    Re: How to run just installed program as administrator one time

    Hello,

    By default, the setup.exe always runs elevated. So if you launch an application from the installer then the elevated privileges are carried over to your product. Please note that if you compile a "per-user" install (that means you changed the UAC Execution Level in General Information from "requireAdministrator" to "asInvoker") then you have to mark the "Run elevated from non-elevated SetupBuilder application" checkbox in the "Run Program" properties to start your app elevated.

    Friedrich
  • 06-23-2013, 01:45 PM
    da spud

    Re: How to run just installed program as administrator one time

    Thank you. I had that but I had used ShellExecute and checked the box and that did not run elevated. I will try it later when I get a chance to be on a system running with UAC and no WinDev yet.

    It seems it is not easy for a program to find out if it is elevated or not. I got mired down in tokens and token types trying to figure it out in a non "C" world.
  • 06-23-2013, 06:57 AM
    linder

    Re: How to run just installed program as administrator one time

    Aha, okay. Yes, that's what I though after re-reading your original question :-) Please see my 2nd reply. Does this work? You can do this without any problem from the SetupBuilder install (run your app elevated from the install). If you need help with this, just let me know.

    Friedrich
  • 06-23-2013, 06:13 AM
    da spud

    Re: How to run just installed program as administrator one time

    Quote Originally Posted by linder View Post
    Hello,

    First of all, you should NOT run your application with administrator execution level privileges by default! NEVER EVER! This is a design failure because only "system tools" should run elevated by default (if needed). Your own application should always run non-elevated by default.....
    Thanks for the reply. I totally agree. Maybe I was not clear enough. I need to do this "Run as Administrator" ONE TIME immediately after installation and never again. That is why I was thinking I would not put that into a manifest.

    Currently I install the program and then find the exe and right click and Run As Administrator for this one time setup. I was hoping to avoid that hassle with SetupBuilder in some fashion.
  • 06-23-2013, 05:50 AM
    linder

    Re: How to run just installed program as administrator one time

    BTW, if you would like to start the installed application (which downloads the components at first run and needs administrator execution level privilegs to handle this) from the elevated running setup.exe directly after the installation, then you can use the "Run Program..." function. See attached screenshot. Add the function after the last Finish "Loop Wizard" and it will execute it (elevated) after the installation.

    Friedrich
  • 06-23-2013, 05:32 AM
    linder

    Re: How to run just installed program as administrator one time

    Hello,

    First of all, you should NOT run your application with administrator execution level privileges by default! NEVER EVER! This is a design failure because only "system tools" should run elevated by default (if needed). Your own application should always run non-elevated by default.

    If your application is a system tool you should embed an UAC manifest which requests the "requireAdministrator" execution level. There should be an option in WinDev to do this. If WinDev can't handle it, you can use the "#embed UAC manifest..." compiler directive in SetupBuilder to embed a manifest into your application .exe.

    Another option (NOT recommended because the functionality is only there to handle completely outdated legacy applications) is to use "Set App Compatibility Mode..." function and enable the "Run this program as administrator" checkbox.

    Does this help?

    By the way, the following is a very brief description of how to make an application "UAC-aware" and Win8-compliant:

    -- Standard Application (YOUR APPLICATION):

    1. Embed an UAC manifest into your main application (.EXE). A manifest basically tells Windows how aware the program is about the recent Windows versions (and disables "Virtualization" and unwanted legacy Installer Detection Technology). You should include a manifest for Windows 8 because it's fully backward compatible with all previous Windows versions.

    2. Request "asInvoker" execution level privileges through the manifest for your application.

    3. Code-sign all your application files (e.g. .EXE, .DLL). Use a certificate signed by a CA, e.g. Comodo, VeriSign, etc.

    4. Your application should not depend on any administrative APIs. Administrative APIs are APIs that never work without elevation. For example, the RegSaveKeyEx API. Or ACL manipulation APIs, etc..

    5. Do not write per-user information or user-writable information to the Program Files folder tree.

    6. Do not write to any other protected Windows area (e.g. the OS drive root folder, the "Windows" folder tree, etc.).

    7. Do not write to the HKEY_LOCAL_MACHINE or any other protected registry key.


    -- Standard Installation (SETUP.EXE):

    1. Use an UAC-aware installation system. By default, installations run elevated (requireAdministrator). Do NOT request asInvoker or highestaAailable if you install per-machine and you need access to protected
    Windows areas.

    2. Install applications per-machine (all users) and store per-user data in different locations.

    3. Do not install Quick Launch shortcuts.

    4. Never write to per-user locations from the elevated running installer. That means, never write to the HKEY_CURRENT_USER registry key or to per-user file locations.

    5. Launch applications non-elevated at the end of the installation process.

    6. Code-sign the installer. Use a certificate signed by a CA, e.g. Comodo, VeriSign, etc.

    Note: if you have to install "per-user" data, install it to a common location and as a "first run" action of your main application, copy the data from the common location into a per-user location.

    Respect the recommended (default) locations for applications and data files, but provide users with an option to select another installation location for both. A true "Mixed User Application" should work elevated and non-elevated.

    That's it :-)

    --
    Friedrich Linder
    Lindersoft
    www.lindersoft.com
    +1.954.252.3910

    --Helping You Build Better Installations
    --SetupBuilder "point. click. ship"
    --Create Windows 8 ready installations in minutes
    --Official Comodo Code Signing and SSL Certificate Partner
  • 06-22-2013, 06:38 PM
    da spud

    How to run just installed program as administrator one time

    In WinDev if you do not include the full library, it will fetch it from the internet for you the first time you run the program. In Vista and above this execution must be done "As Administrator" in order to get the files to go where WD wants to put them.

    How do I get the app just installed to run (after the completion of the setup) "As Administrator"? I have it running now if the user checks a box run this after setup, but it is not as administrator.

    Thanks.

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •