views:

27

answers:

1

I have an install project (running on Windows 7) that launches a custom action at commit which starts the application that was just installed. During the startup of this application I have a method that checks the current user's name to perform some authentication. When launched from this custom action I am getting 'NTAUTHORITY\SYSTEM' instead of 'DOMAIN\USER'

Update: This link from the accepted answer is what solved my issue:

How can I customize an MSI in the Visual Studio setup/deployment project?

+3  A: 

You probably should read the value of the USERNAME MSI property:

string username = Session.Property("USERNAME");

The above will work in immediate execution mode; however, in deferred mode you will explicitly have to pass the user name using the CustomActionData property to your custom action. For details see here:

Tip: MSI Properties and Deferred Execution

UPDATE: If you want to launch the installed application after the setup is completed you might prefer the approach described in this article:

Launching Your Application After Install using Visual Studio 2005

or use Aaron Stebner's script to modify your MSI:

How can I customize an MSI in the Visual Studio setup/deployment project?

0xA3
The code where the call to 'WindowsIdentity' is located in the application that is being installed, it has no knowledge of the msi
jwarzech
@jwarzech: Then your question seems to be a different one? "How to launch the installed application after installation?" Which tool do you use to produce your setup?
0xA3
I have a VS2008 deployment project that installs an application and then calls a CustomAction that runs 'Process.Start(myapplication)'. The first thing that the application does is checks the WindowsIdentity and looks up the user in an authorization database table.
jwarzech
Thank you! Aaron Stebner's script did the trick.
jwarzech