Run ExeCommand in customAction as Administrator mode in Wix Installer

The wix documentation here explains the Impersonate attribute: This attribute specifies whether the Windows Installer, which executes as LocalSystem, should impersonate the user context of the installing user when executing this custom action. Typically the value should be ‘yes’, except when the custom action needs elevated privileges to apply changes to the machine. You also … Read more

Elevating privileges doesn’t work with UseShellExecute=false

ProcessStartInfo.Verb will only have an effect if the process is started by ShellExecuteEx(). Which requires UseShellExecute = true. Redirecting I/O and hiding the window can only work if the process is started by CreateProcess(). Which requires UseShellExecute = false. Well, that’s why it doesn’t work. Not sure if forbidding to start a hidden process that … Read more

Request Windows Vista UAC elevation if path is protected?

The best way to detect if they are unable to perform an action is to attempt it and catch the UnauthorizedAccessException. However as @DannySmurf correctly points out you can only elevate a COM object or separate process. There is a demonstration application within the Windows SDK Cross Technology Samples called UAC Demo. This demonstration application … Read more

How to set ‘Run as administrator’ on a file using Inno Setup

You can add a Registry entry in [Registry] Section that will set run as Administrator as a default action for running this app. Example: Root: “HKLM”; Subkey: “SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers”; \ ValueType: String; ValueName: “{app}\tomcat7w.exe”; ValueData: “RUNASADMIN”; \ Flags: uninsdeletekeyifempty uninsdeletevalue; MinVersion: 0,6.1

Installing application for currently logged in user from Inno Setup installer running as Administrator

Inno Setup does not have any built-in mechanism to access or modify user environment from installer running with elevated/Administrator privileges. All the attempts to achieve this rely on tricks like: runasoriginaluser flag or ExecAsOriginalUser function. Some examples: Modifying or accessing registry of logged in user: Inno Setup Creating registry key for logged in user (not … Read more