Pascal Scripting: ShellExecAsOriginalUser

Prototype:

function ShellExecAsOriginalUser(const Verb, Filename, Params, WorkingDir: String; const ShowCmd: Integer; const Wait: TExecWait; var ErrorCode: Integer): Boolean;

Description:

Opens the specified file or performs another action specified by Verb, using the (normally non-elevated) credentials of the user that started Setup initially. See ShellExec and the [Run] section flag runasoriginaluser for more information.

Remarks:

This function is not supported at uninstall time.

In very unusual failure cases (e.g. if the initial Setup process died unexpectedly), it is possible for this function to raise an exception instead of just returning False.

Refer to the system error codes on MSDN [external link].