When running the installer on Windows a user gets prompted for a elevated username / password to run the installer as, however in the postInstallationActionList stage of the installer I'm calling runProgram to start up the application which has just been installed. This starts the application up as the elevated users account, and not the current users account.

Is there any way I can work around this?

asked 08 Mar '13, 06:25

A%20Jefferiss's gravatar image

A Jefferiss
accept rate: 100%

It is not currently possible to run the application as the original user if the installer was started as another user.

We will investigate options for improving this behavior and let you know if there are options for improving it.


answered 10 Mar '13, 15:29

wojciechka's gravatar image

wojciechka ♦♦
accept rate: 26%

Ok thank you

(11 Mar '13, 04:13) A Jefferiss

Is there any way to get around this issue yet? It's pretty standard practice for an installer to run the application it's installed. Any help would be much appreciated.

(24 Jun '13, 15:58) danish

The problem is only happening with non-administrative user running installer by logging in as an administrator. Unfortunately it is not possible to handle this on Windows - without knowing the original user's password, it is not possible to run programs as currently logged in user.

However, it is possible to detect the situation to prevent from running the application as incorrect user. The following XML detects if current user is the currently logged in user. You can use that to show a warning or do not run certain actions by default if ${running_as_loggedin_user} is true or false.

<initializationActionList> <writeFile> <path>${system_temp_directory}/wmic_get.bat</path> <text>wmic path win32_computersystem get username /value &gt;wmic_output.txt</text> </writeFile> <runProgram> <program>./wmic_get.bat</program> <programArguments></programArguments> <workingDirectory>${system_temp_directory}</workingDirectory> </runProgram> <readFile> <encoding>unicode</encoding> <name>wmic_output</name> <path>${system_temp_directory}/wmic_output.txt</path> <removeBOM>1</removeBOM> </readFile> <deleteFile> <path>${system_temp_directory}/wmic_output.txt</path> </deleteFile> <deleteFile> <path>${system_temp_directory}/wmic_get.bat</path> </deleteFile> <setInstallerVariable> <name>loggedin_user</name> <value>${system_username}</value> </setInstallerVariable> <setInstallerVariableFromRegEx> <name>loggedin_user</name> <pattern>.*UserName=(.*)\\(.*?)\s.*$</pattern> <substitution>\2</substitution> <text>${wmic_output}</text> <ruleList> <regExMatch> <logic>matches</logic> <pattern>.*UserName=(.*)\\(.*?)\s.*$</pattern> <text>${wmic_output}</text> </regExMatch> </ruleList> </setInstallerVariableFromRegEx> <if> <actionList> <setInstallerVariable> <name>running_as_loggedin_user</name> <value>1</value> </setInstallerVariable> </actionList> <conditionRuleList> <compareText> <logic>equals</logic> <nocase>1</nocase> <text>${loggedin_user}</text> <value>${system_username}</value> </compareText> </conditionRuleList> <elseActionList> <setInstallerVariable> <name>running_as_loggedin_user</name> <value>0</value> </setInstallerVariable> </elseActionList> </if> </initializationActionList>


answered 27 Jun '13, 03:59

wojciechka's gravatar image

wojciechka ♦♦
accept rate: 26%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 08 Mar '13, 06:25

Seen: 2,828 times

Last updated: 27 Jun '13, 03:59