My installer run in all users, and it saves user information in the AppData folder.

The problem is that, when the installation is finished, an executable is launched by means of an Exec and it is launched as the administrator user, so all the session data is stored in the administrator's AppData. I want to run the installation as Admin but the last step as the current user.

RequestExecutionLevel admin

Can I launch my application as the current user? Can I keep the current user before ask for admin privilages?

1 Answers

Anders On Best Solutions

The Microsoft guidelines say:

Certification requirements for Windows Desktop Apps

  • Apps must install to the correct folders by default
    • 10.6 Your app must write user data at first run and not during the installation in per-machine installations. When the app is installed, there is no correct user location in which to store data.

If you have some sort of default user data/template you should install that in %ProgramFiles% or %ProgramData% and your application should copy that data to %AppData% the first time a user runs your application.

The ShellExecAsUser and StdUtils plug-ins can be used to execute your application as the "real" user on the finish page.

The UAC plug-in allows you to access the "real" users %AppData% and registry but I don't recommend this approach because the plug-in is hard to use and it really promotes incorrect behavior. You are very likely to end up with a install pattern that only works for the initial user and not other users on the same machine.