Disable password in WIx Installer - wix

I have a installer project which is developed in Wix.
I have the below code with util:xmlconfig
<util:XmlConfig
Id="xml.SetMYPassword"
Action="create"
ElementPath="/configuration/DataReport/Password"
Node="value"
Value="[MY_PASSWORD]"
File="[#MyService]"
On="install"
PreserveModifiedDate="yes"
Sequence="1" />
Now the issue is, when I am installing the package the password is shown like "myPassword" instead of ******. How can we change the above code such that the password should not be displayed.

If you are trying to stop the MY_PASSWORD property from appearing in the log you should set the hidden attribute to yes in its declaration.
<Property Id="MY_PASSWORD" Hidden="yes" Secure="yes" />
Note that the util:XmlConfig custom action may still display this in its own internal logging.

Related

Wix SetProperty if Property does not have a value

I have the following code in my WiX installer:
<Property Id="CONFIGPATH" />
<SetProperty Id="CONFIGPATH" After="AppSearch" Value="[INSTALLFOLDER]servers.cfg">NOT CONFIGPATH</SetProperty>
The intention is that the user may pass a custom CONFIGPATH to the installer. If they do not pass a custom path, a default path targetting the installation folder is used. However, this code does not work. SetProperty never fires.
If instead I write:
<Property Id="CONFIGPATH" />
<SetProperty Id="CONFIGPATH" After="AppSearch" Value="[INSTALLFOLDER]servers.cfg"></SetProperty>
The property is updated to (the calculated value of) [INSTALLFOLDER]servers.cfg correctly.
Why might this be?
For some reason, AppSearch is too early in the install sequence. It was necessary to change the code to a later point in the sequence:
<Property Id="CONFIGPATH" />
<SetProperty Id="CONFIGPATH" Sequence="execute"
Before="InstallFiles"
Value="[INSTALLFOLDER]servers.cfg">NOT CONFIGPATH</SetProperty>

How can I optionally install IIS virtual directory with WiX Toolset?

I'm trying to optionally install a virtual directory if IIS is installed. If it's not installed, then just skip it.
I've got this check:
<Fragment>
<Property Id="IIS_MAJOR_VERSION">
<RegistrySearch Id="CheckIISVersion"
Root="HKLM"
Key="SOFTWARE\Microsoft\InetStp"
Name="MajorVersion"
Type="raw" />
</Property>
<iis:WebSite Id='DefaultWebSite' Description='Default Web Site' Directory='INSTALLFOLDER'>
<iis:WebAddress Id="AllUnassigned" Port="80" />
</iis:WebSite>
</Fragment>
and based on the IIS_MAJOR_VERSION being present, I install the feature:
<Feature Id="ProductFeature2" Title="Setup" Level="1">
<ComponentRef Id="AppIIS" />
<Condition Level="0">NOT IIS_MAJOR_VERSION</Condition>
</Feature>
This part seems to work, however, the iis:WebSite node is causing issues. I only want to locate it if IIS_MAJOR_VERSION is present as well.
If I move the iis:WebSite node into the component group it works, but then iis:WebSite is not in 'locator' mode and gets installed and uninstalled (which is bad).
Is there a way I can conditionally run the check for iis:WebSite?
When you add any element from IIS extension (like <iis:WebSite>), a special custom action called ConfigureIIs is added to the InstallExecuteSequence table. This custom action is a so-called entry point to everything related to IIS management with the help of WiX IIS extension.
Fortunately, ConfigureIIs custom action is conditioned by default the way to skip it if need be. If you open the resulting MSI package with Orca and navigate to InstallExecuteSequence table on the left pane, you'll see the condition uses SKIPCONFIGUREIIS property. Thus, the idea is to set it to something (e.g. 1) in case you don't need to perform any IIS related activities.
It can be done with SetProperty element:
<SetProperty Id="SKIPCONFIGUREIIS" Value="1">NOT IIS_MAJOR_VERSION</SetProperty>

Wix install location

I have a WIX setup that allows the user to select the install location. When uninstalling, I need to run a custom action that should activate a file in the install location. I tried getting the install location from session["INSTALLDIR"] but it results in the default path and not the one given by the user.
How can I reach that location?
I've done this in my own installer - the following should work.
This adds a property to retrieve the install location value from the registry.
<Property Id="INSTALLDIR">
<RegistrySearch Id='Registry' Type='raw' Root='HKCU' Key='Software\$(var.Manufacturer)\$(var.ProductName)' Name='Location' />
</Property>
This sets the install location in the registry.
<Component Id="Registry" Guid="*">
<RegistryKey Root="HKCU" Key="Software\$(var.Manufacturer)\$(var.ProductName)">
<RegistryValue Name="Location"
Type="string"
Value="[INSTALLDIR]"
Action="write"
KeyPath="yes" />
</RegistryKey>
<util:RemoveFolderEx On="uninstall" Property="INSTALLDIR" />
If you want INSTALLDIR for a later time such as uninstallation you should use Remember property pattern described in link below.
"The root issue is that the Windows Installer does not save Property values for you. That means if the user enters values in the install UI or passes them on the command-line, those values will be not be present during repair, upgrade nor uninstall."
http://robmensching.com/blog/posts/2010/5/2/the-wix-toolsets-remember-property-pattern/

Not able to update XML value in Change mode (without admin rights)

I have written following code in my wix installer for updating the language in an XML file and this works fine in following conditions:
1) fresh install
2) upgrade by using admin rights (I am using msiexec /I "Tools.msi" /l*v D:\InstallLog.txt).
However, when I run/execute the msi without admin rights (This is where "Change" mode is being used....what am I missing) the values are not updating always set to the default value :
<Property Id="LANGUAGE" Value="en-US" />
The code:
<util:XmlFile Id="LanguageConfig"
Value="[LANGUAGE]"
ElementPath="/configuration/appSettings/add[\[]#key='Language'[\]]"
Action="setValue"
File="$(var.ConfigFile)"
Name="value" Sequence="1" />
<util:XmlFile Id="MappingLanguageXML"
Value="[LANGUAGE]"
ElementPath="/MappedUsers/UsersList/UserID/LanguageCode"
Action="setValue"
File="$(var.UserMappingFile)" Sequence="1" />
Any help is much appreciated.
The fact that it's being changed implies it may not be a privilege issue. I suspect that the scenario is that a different language was entered at install time, but you did not preserve its value anywhere so Change just uses the default value. Properties aren't remembered automatically, that's what the WiX "remember property" pattern is for. That's likely to be the solution - preserve the install time value of LANGUAGE. It's no different from running any program - the fact that the user may have entered something that went into a variable doesn't mean that the variable will have that same value next time you run the program unless you save it.
Based on PhilDw pointer I solved the issue by modifying my property
<Property Id="LANGUAGE" Value="en-US" />
as follows:
<Property Id="LANGUAGE" Secure="yes" Value="en-US">
<RegistrySearch Id="RememberLanguage" Root="HKLM"
Key="$(var.RegistryLoc)"
Name="Language" Type="raw" />
</Property>
By preserving the value in the registry I was able to modify the value during "Change" operation.

Why isn't my Wix Property being evaluated?

I'm trying to simulate the InstallURL property of a VS.net install MSI... I've got to the ponit where the WIX MSI will open a browser to the download page that I want it to go to. I thought things were going great because on my test machine, the web page opened when I didn't have the MSXML6 component installed. However things went downhill when I discovered that the web page opened even when I DID have the component installed.
I'm searching for the MSXML6 component using a Property w/ a RegistrySearch. However, as best as I can tell, the registry value isn't even being evaluated, and thus it "always" looks like it isn't installed.
Here's the relevant portion of my WXS:
<Property Id="MSXML6">
<RegistrySearch Id="MSXML6Search" Root="HKCR" Key="Msxml2.DOMDocument.6.0" Type="raw" />
</Property>
<Property Id="TEST">
<RegistrySearch Id="TESTSearch" Root="HKLM" Type="raw" Name="Version" Key="SOFTWARE\Microsoft\DirectX" />
</Property>
<Property Id="cmd.exe" Value="cmd.exe" />
<CustomAction Id="OpenMSXML6Download" Property="cmd.exe" ExeCommand="/c start http://www.microsoft.com/downloads/details.aspx?FamilyID=993c0bcf-3bcf-4009-be21-27e85e1857b1" Execute="immediate" Return="check" />
<CustomAction Id="OpenMSXML6DownloadError" Error="This component requires MSXML6. =[MSXML6]=[cmd.exe]=[TEST]= A web browser has been opened to the download page. Please install MSXML6 and then re-install the connector." />
<!-- installation execution sequence -->
<InstallExecuteSequence>
<!-- wires the error dialog to the downgrade event -->
<Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
<!-- execution to delete old install info after upgrade-->
<RemoveExistingProducts After="InstallValidate" />
<!-- Forces MSXML6 to be pre-installed -->
<!-- <Custom Action="OpenMSXML6Download" Before="FindRelatedProducts">NOT MSXML6</Custom> -->
<Custom Action="OpenMSXML6Download" Before="FindRelatedProducts">NOT MSXML6</Custom>
<Custom Action="OpenMSXML6DownloadError" After="OpenMSXML6Download">NOT MSXML6</Custom>
</InstallExecuteSequence>
<!-- ui information for the custom actions above. -->
<InstallUISequence>
<Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
<Custom Action="OpenMSXML6Download" Before="FindRelatedProducts">NOT MSXML6</Custom>
<Custom Action="OpenMSXML6DownloadError" After="OpenMSXML6Download">NOT MSXML6</Custom>
</InstallUISequence>
What this does is if MSXML6 isn't defined then it opens the web page and then prints the custom error message. Note that I'm trying to print the value of the property in the error message (I'm not sure if this is valid or not, but it seems to be.) The text that I see says "This component requires MSXML6. ==[cmd.exe]==..." so it is printing the value of the 'cmd.exe' property but not the other two... maybe that's because I define the property explicitly, I'm not sure... Anyway, I also ran the MSI with debugging on, and in the log file, I see absolutely no reference at all to the MSXML6 or the TEST properties ever being set. I've confirmed that the registry values are indeed set, although I'm not 100% sure how to handle the Msxml2 registry key, since it doesn't have any real values, only a default value. (I'm assuming that leaving off the 'Name' parameter is the right way to handle this.)
Help??
I managed to figure this one out... it was quite a simple answer. Basic issue was that the Custom Actions were executing before AppSearch, which is where the RegistrySearch properties get evaluated. See my blog post at CTICoder for details.