[wix-users] Custom Action with elevated privilege

Habib Salim habib at hsalim.com
Fri Dec 14 09:17:14 PST 2018


Have you considered modifying the application.exe.config file in your
installer?

     xmlns:util ="http://schemas.microsoft.com/wix/UtilExtension" >

      <Component Id="cmpModifyApplicationConfig1" Guid="<yourguid>"
KeyPath="yes">
        <util:XmlConfig Id="editConnectionString"
                        File="[#$(var.ExeName).config]"
                        Action="create"
                        On="install"
                        Node="value"
                        Name="connectionString"
                        Value="[CONNECTION_STRING]"
 
ElementPath="//configuration/connectionStrings/add[\[]@name
=myapplication.Properties.Settings.ConnectionString'[\]]"
                        />
      </Component>
      <Component Id="cmpModifyApplicationConfig2"
Guid="81E3C9D3-CE94-4A91-8D62-05CD14CEB40F" KeyPath="yes">
        <util:XmlConfig Id="setDefaultCompanyName"
                        File="[#$(var.ExeName).config]"
                        Action ="create"
                        On="install"
	          Node="value"
                        Value="[LICENSEE_NAME]"
 
ElementPath="//configuration/applicationSettings/myapplication.Properties.
Settings/setting[\[]@name ='settingName'[\]]/value"
                         />
      </Component>

-----Original Message-----
From: wix-users <wix-users-bounces at lists.wixtoolset.org> On Behalf Of
Wenzheng Jia via wix-users
Sent: Friday, December 14, 2018 11:38 AM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>;
Hoover, Jacob <Jacob.Hoover at greenheck.com>
Cc: Wenzheng Jia <WJia at liaison.com>
Subject: Re: [wix-users] Custom Action with elevated privilege

The config.exe basically is a configuration tool that retrieves the
settings for a customer and writes them to an ini file. The issue I'm
having right now is that after the config.exe is invoked, the user can go
through all the config settings. It's at the time of writing the config
file to the installation folder, that's where the issue is. It requires a
higher level of privilege to be able to write the ini file to the
installation folder. 

We currently have an NSIS script to do so. That installer is working as
expected. We are trying to move to the WiX ToolSet but running into this
issue. Grantly, I'm still new to the toolset and still trying to figuring
things out as I convert them. 

Wenzheng

-----Original Message-----
From: wix-users <wix-users-bounces at lists.wixtoolset.org> On Behalf Of
Christopher Painter via wix-users
Sent: Friday, December 14, 2018 10:01 AM
To: Hoover, Jacob <Jacob.Hoover at greenheck.com>; WiX Toolset Users Mailing
List <wix-users at lists.wixtoolset.org>
Cc: Christopher Painter <chrpai at iswix.com>
Subject: Re: [wix-users] Custom Action with elevated privilege

I believe we are in 100% agreement.  I don't know what his config.exe is
doing so it's impossible for me to say what the proper solution is.

________________________________
From: Hoover, Jacob <Jacob.Hoover at greenheck.com>
Sent: Friday, December 14, 2018 9:53 AM
To: Christopher Painter; WiX Toolset Users Mailing List
Subject: RE: Custom Action with elevated privilege


First run is fine, but it shouldn't require elevation to configure the
application. There are well defined locations where an application can
store configs (either per user or per machine) which don't require
elevation.



The issue with "but I just want to write this 1 file" is there is nothing
preventing it from changing anything else.  And typically the installer
developer and the app developer are different people, so while the 1 file
may be true today it may not be tomorrow. Hence why if it has to be in a
restricted location, it should be written/updated by a CA in the
installer.



From: Christopher Painter [mailto:chrpai at iswix.com]
Sent: Friday, December 14, 2018 9:48 AM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Cc: Hoover, Jacob <Jacob.Hoover at greenheck.com>
Subject: Re: Custom Action with elevated privilege



Handling config in an MSI can be a pain.  Running an EXE after the install
can be a good compromise.  Usually when I do it  I make it optional and I
have the make program call it on first run if configuration hasn't
occurred.  I usually put the configuration data in a registry key or
folder that doesn't require elevation.   This usually works well.



I typically only handle configuration in the installer when it's needed to
execute sql scripts or setup a windows service or application with a
certain account.  Otherwise I tend to push it to application first run.



________________________________

From: wix-users
<wix-users-bounces at lists.wixtoolset.org<mailto:wix-users-bounces at lists.wix
toolset.org>> on behalf of Hoover, Jacob via wix-users
<wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org>>
Sent: Friday, December 14, 2018 9:15 AM
To: WiX Toolset Users Mailing List
Cc: Hoover, Jacob
Subject: Re: [wix-users] Custom Action with elevated privilege



Why not write a proper CA that can be ran during the installation
sequence? What is its need for modifying machine state after the
installation is complete?

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf
Of Wenzheng Jia via wix-users
Sent: Thursday, December 13, 2018 9:15 PM
To: WiX Toolset Users Mailing List
<wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org>>
Cc: Wenzheng Jia <WJia at liaison.com<mailto:WJia at liaison.com>>
Subject: Re: [wix-users] Custom Action with elevated privilege

I changed the manifest of the configuration executable. Now the event
doesn't trigger the configuration executable's UI to show up at all. Any
thoughts?

Wenzheng

-----Original Message-----
From: wix-users
<wix-users-bounces at lists.wixtoolset.org<mailto:wix-users-bounces at lists.wix
toolset.org>> On Behalf Of Rob Mensching via wix-users
Sent: Thursday, December 13, 2018 4:01 PM
To: WiX Toolset Users Mailing List
<wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org>>
Cc: Rob Mensching <rob at firegiant.com<mailto:rob at firegiant.com>>
Subject: Re: [wix-users] Custom Action with elevated privilege

Manifest the executable to require elevation

_____________________________________________________________
 Short replies here. Complete answers over there:
https://link.spamstopshere.net/u/c36bf3d1/uNi6nL7-6BG6rhrI9e_1Kg?u=https%3
A%2F%2Furldefense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttp-3A__www.firegiant.c
om_%26d%3DDwICAg%26c%3DPSLapdneSrIm6YCSwp9NIGuZt5KBqytXkQWJ6tZG4UQ%26r%3D1
Rm10nvLj379JDc0olGT1Q%26m%3DavZa-T5fw-SOKT3TquIRo1WmRnXgOTWNtV5hFWlvt4Y%26
s%3Dfig_YK_LGEbx77zlghw1Vgh7yLkHiCkil4caTdKkgo0%26e%3D

-----Original Message-----
From: wix-users
<wix-users-bounces at lists.wixtoolset.org<mailto:wix-users-bounces at lists.wix
toolset.org>> On Behalf Of Wenzheng Jia via wix-users
Sent: Thursday, December 13, 2018 1:56 PM
To: wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org>
Cc: Wenzheng Jia <WJia at liaison.com<mailto:WJia at liaison.com>>
Subject: [wix-users] Custom Action with elevated privilege

I'm creating an installer to launch an executable after the installation.
The executable will only be launched when a checkbox is selected on the
ExitDialog. I hooked up the CustomAction to the Finish button of the
ExitDialog box. I'm able to launch the executable. But the executable
doesn't have the elevated privilege. It failed to save the output file to
the installation folder due to lack of privilege. Is there any way that I
can accomplish this?

<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Run Wizard to
configure the Connector config file" />

<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction"
Value="LaunchFile" Order="999">(NOT Installed) AND
(WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1)</Publish>


<CustomAction Id='LaunchFile' Directory='APPLICATIONFOLDER'
ExeCommand='[APPLICATIONFOLDER]Config.exe' Impersonate='no'
Return="asyncNoWait" />

Wenzheng Jia
Senior Software Engineer

Liaison Technologies
3157 Royal Drive | Suite 200 | Alpharetta, GA 30022
T: +1 888.806.0309 x525
https://link.spamstopshere.net/u/49ced0dc/2P66nL7-6BG6rhrI9e_1Kg?u=https%3
A%2F%2Furldefense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttp-3A__www.liaisonheal
thcare.com%26d%3DDwICAg%26c%3DPSLapdneSrIm6YCSwp9NIGuZt5KBqytXkQWJ6tZG4UQ%
26r%3D1Rm10nvLj379JDc0olGT1Q%26m%3DavZa-T5fw-SOKT3TquIRo1WmRnXgOTWNtV5hFWl
vt4Y%26s%3DkKXHAPnLhNVfz78aKLK0T8ObJcLe5UxuZYlWuvA_Eg4%26e%3D
<https://link.spamstopshere.net/u/11d390be/Dhm7nL7-6BG6rhrI9e_1Kg?u=https%
3A%2F%2Furldefense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttp-3A__www.liaisonhea
lthcare.com_%26d%3DDwICAg%26c%3DPSLapdneSrIm6YCSwp9NIGuZt5KBqytXkQWJ6tZG4U
Q%26r%3D1Rm10nvLj379JDc0olGT1Q%26m%3DavZa-T5fw-SOKT3TquIRo1WmRnXgOTWNtV5hF
Wlvt4Y%26s%3DJ0tBdN8mP8E_tHcSGJHeix-C1nudBqnt_WzIkpICt78%26e%3D>Connect
with
us!<https://link.spamstopshere.net/u/2c4d34ee/XjK7nL7-6BG6rhrI9e_1Kg?u=htt
p%3A%2F%2Fliaison.com%2Fabout-liaison%2Fcommunities>


____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant
https://link.spamstopshere.net/u/c36bf3d1/uNi6nL7-6BG6rhrI9e_1Kg?u=https%3
A%2F%2Furldefense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttp-3A__www.firegiant.c
om_%26d%3DDwICAg%26c%3DPSLapdneSrIm6YCSwp9NIGuZt5KBqytXkQWJ6tZG4UQ%26r%3D1
Rm10nvLj379JDc0olGT1Q%26m%3DavZa-T5fw-SOKT3TquIRo1WmRnXgOTWNtV5hFWlvt4Y%26
s%3Dfig_YK_LGEbx77zlghw1Vgh7yLkHiCkil4caTdKkgo0%26e%3D

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant
https://link.spamstopshere.net/u/d5d84483/0GC7nL7-6BG6rhrI9e_1Kg?u=https%3
A%2F%2Furldefense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttp-3A__www.firegiant.c
om_%26d%3DDwIF-g%26c%3DPSLapdneSrIm6YCSwp9NIGuZt5KBqytXkQWJ6tZG4UQ%26r%3D1
Rm10nvLj379JDc0olGT1Q%26m%3DaUStesA1Ad3NxOp8Vb7d1nKUDl4GOX8fN-xwbFb5Ndw%26
s%3DWHb4koSWv4sZsTm6ULD8emyBzmF_naDhJAbdOAAAgL0%26e%3D
NOTE: This email was received from an external source. Please use caution
when opening links or attachments in the message.

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant
https://link.spamstopshere.net/u/d5d84483/0GC7nL7-6BG6rhrI9e_1Kg?u=https%3
A%2F%2Furldefense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttp-3A__www.firegiant.c
om_%26d%3DDwIF-g%26c%3DPSLapdneSrIm6YCSwp9NIGuZt5KBqytXkQWJ6tZG4UQ%26r%3D1
Rm10nvLj379JDc0olGT1Q%26m%3DaUStesA1Ad3NxOp8Vb7d1nKUDl4GOX8fN-xwbFb5Ndw%26
s%3DWHb4koSWv4sZsTm6ULD8emyBzmF_naDhJAbdOAAAgL0%26e%3D

NOTE: This email was received from an external source. Please use caution
when opening links or attachments in the message.

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant
https://link.spamstopshere.net/u/d5d84483/0GC7nL7-6BG6rhrI9e_1Kg?u=https%3
A%2F%2Furldefense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttp-3A__www.firegiant.c
om_%26d%3DDwIF-g%26c%3DPSLapdneSrIm6YCSwp9NIGuZt5KBqytXkQWJ6tZG4UQ%26r%3D1
Rm10nvLj379JDc0olGT1Q%26m%3DaUStesA1Ad3NxOp8Vb7d1nKUDl4GOX8fN-xwbFb5Ndw%26
s%3DWHb4koSWv4sZsTm6ULD8emyBzmF_naDhJAbdOAAAgL0%26e%3D

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant
https://link.spamstopshere.net/u/06792441/TqG7nL7-6BG6rhrI9e_1Kg?u=http%3A
%2F%2Fwww.firegiant.com%2F



More information about the wix-users mailing list