How to write to the user's My Documents directory with installer when the user used 'Run As Administrator'
The answer to the original is valid but not recomended. When the setup is run, RunAsOriginalUser
will run as the user currently logged into Windows.
This is done by having part of the setup run unelevated, and then run another copy that is elevated to do the actual install.
When the user explicitly does "Run as admin", the "unelevated stub" runs elevated as well, in which case, there is nothing the setup can do to access the original user as that information has already been replaced.
The accepted practice is to do any profile specific work in the application itself as you suggested, which also means it will work for other users and in a LUA environment in pre Vista (Where you would have had exactly the same situation that you're seeing now).