I am installing a web service while running MSI, but is running under Local System by default. I want it to run under specific user which is logged in to the system. this we can do by changing the log on property of the service but I want to do this while installation. so, how I can create a custom UI in wix for asking username and password from user. I have 2 files- service.wxs and product.wxs and I am trying something like :
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI Id="myUI">
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<Dialog Id="myDlg" Height="400" Width="550" Title="User Sample UI" >
<Control Id="myEdit" Type="Edit" Property="USERNAME" Height="17" Width="100" X="50" Y="50" Indirect="yes" Text="[USERNAME]"/>
<Control Id="meEdit" Type="Edit" Property="PASSWORD" Password="yes" Height="20" Width="100" X="80" Y="50" Indirect="yes" Text="[PASSWORD]"/>
</Dialog>
</UI>
</Fragment>
<Fragment>
<DirectoryRef Id="FOLDER">
<Component Id="..." Guid="*">
<File Id="..." KeyPath="yes" Source="SourceDir\Service.exe" />
<wix:ServiceInstall Id="Install" Account="[USERNAME]" Password="[PASSWORD]" Name="...." Description="..." ErrorControl="ignore" Start="auto" Type="ownProcess" Vital="yes" Interactive="no" xmlns:wix="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" />
But this is not working, I am not getting any pop up. Do I need to give some reference in product.wxs as well?
Please help.
Add a new dialog like this. Add the dialog inside the main UI Sequence file.
<UI>
<Dialog Id="AccountDlg" Width="370" Height="270" Title="!(loc.InstallDirDlg_Title)">
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Please insert user account and password " />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="{\Font_Title}User account and password " />
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="AccountTitle" Type="Text" X="20" Y="60" Width="290" Height="18" NoPrefix="yes" Text="Enter user and password: " />
<Control Id="AccountDis" Type="Text" X="20" Y="80" Width="100" Height="18" NoPrefix="yes" Text="User account name: " />
<Control Id="AccountVar" Type="Edit" X="120" Y="80" Width="100" Height="18" Property="INSTALLED_USERNAME" Indirect="no" />
<Control Id="PasswordDis" Type="Text" X="20" Y="110" Width="100" Height="18" NoPrefix="yes" Text="Password: " />
<Control Id="PasswordVar" Type="Edit" X="120" Y="110" Width="100" Height="18" Property="PASSWORD" Indirect="no" Password="yes" />
</Dialog>
</UI>
Use custom action set property to get the user name and domain from the target computer.
<SetProperty Id="INSTALLED_USERNAME" Value="[%USERDOMAIN]\[%USERNAME]" Before="CostFinalize" Sequence="ui" />
Set default password.
<Property Id="PASSWORD" Value="A123456!"/>