SOLUTION:
The installation runs in the SYSTEM account. Therefor the created process is also run in said account, not as the currently logged in user.
I created an additional project (InstallHelper), which includes the
Process.Start("Outlook");
I added the InstallHelper as CustomAction on Commit in my setup project and changed InstallerClass to False in the properties of the CustomAction. Then I copied WiRunSql.vbs to the project folder and added an PostBuildEvent to the setup project:
@echo off
cscript //nologo "$(ProjectDir)WiRunSql.vbs" "$(BuiltOutputPath)" "UPDATE CustomAction SET Type=1554 WHERE Type=3602"
3602:
- 0x800 (msidbCustomActionTypeNoImpersonate)
- 0x400 (msidbCustomActionTypeInScript)
- 0x200 (msidbCustomActionTypeCommit)
- 0x12 (Custom Action Type 18: exe)
1554:
- 0x400 (msidbCustomActionTypeInScript)
- 0x200 (msidbCustomActionTypeCommit)
- 0x12 (Custom Action Type 18: exe)
See: msdn: Custom Action In-Script Execution Options
The Type-change removed the bit for msidbCustomActionTypeNoImpersonate (0x00000800), so the InstallHelper and the created process are run as the logged in user, not as SYSTEM.
Alternatively those changes are possible via opening the msi in orca (has to be repeated after each build, so I prefer the scripted change).