Change Sequence to ui,  and then in the install execute sequence, you will 
probably want to abort if the property isn't assigned.  This means users double 
clicking the MSI would get the value assigned from the install ui sequence, but 
automated deployments or quiet/silent installs would be forced to pass the 
domain\username as a property on the command line. 

  I assume this is a per machine MSI not a per user MSI.

  If you need to get more extravagant, then you would be looking at passing 
UserSID to a CA and decoding the account info.

                string userSid = session.CustomActionData["UserSID"];
                SecurityIdentifier sid = new SecurityIdentifier(userSid);
                NTAccount ntAccount = 
(NTAccount)sid.Translate(typeof(NTAccount));
                string username = ntAccount.ToString();

or you could look at some existing projects like http://msiext.codeplex.com/


-----Original Message-----
From: Neil Sleightholm [mailto:n...@x2systems.com] 
Sent: Friday, September 21, 2012 12:07 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] variables not working...

Did you try my suggestion of LogonUser?
    <SetProperty Id="DATABASE_USERNAME" Value="[LogonUser]" 
Before="InstallInitialize" Sequence="execute" />

The problem is that this will only return the name and not the domain so you 
might have to resort to a custom action.

I don't think reading the environment variables will work as the MSI is in the 
context of the msiexec service not the user that is logged on.

Neil

-----Original Message-----
From: StevenOgilvie [mailto:sogil...@msn.com] 
Sent: 21 September 2012 16:37
To: wix-users@lists.sourceforge.net
Subject: -----SPAM----- Re: [WiX-users] -----SPAM----- variables not working...

Sigh, now I am getting nothing...

I have tried:


    <SetProperty Id="DATABASE_USERNAME" Value="[%USERDOMAIN]\[%USERNAME]"
Before="InstallInitialize" Sequence="execute"  />

where LogonDomainName is:
 <?define LogonDomainName = "[%USERDOMAIN]"?>

how hard can it be to get a system variable at runtime?

Steve



--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/variables-not-working-tp7580709p7580744.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to