views:

374

answers:

0

Hi All,

I have created a WIX setup script to allow the install of a Windows Service.

I would like to give the user the ability to choose whether they would like to install under one of the standard accounts (Network Service, Local Service) or whether they would like to install under a user account with which they must supply a username and password.

The ServiceInstall accepts a single property as the Account which could be the SID for the standard account (e.g. NT Authority\NetworkService) or the username when the chosen account type was Other (e.g. mydomain\mcook).

<ServiceInstall Id="HWS" Name="HelloWorldService" DisplayName="HelloWorldService" Type="ownProcess" Start="auto" ErrorControl="normal" Description="HelloWorldService" Account="[SERVICE_USERNAME]" Password="[SERVICE_PASSWORD]">

As such I am passing in [SERVICE_USERNAME] property which is bound to the username textbox of my custom UI: -

<Control Id="UsernameTextBox" Type="Edit" X="80" Y="130" Width="130" Height="18" Property="SERVICE_USERNAME" />

Here's my account type combo: -

<ComboBox Property="ACCOUNT_TYPE"> <ListItem Text="Network Service" Value="NT AUTHORITY\NetworkService" /> <ListItem Text="Local Service" Value="LocalService" /> <ListItem Text="Other..." Value="Other" /> </ComboBox>

Ideally, what I need to be able to do is to modify the SERVICE_USERNAME property to be the ACCOUNT_TYPE if the ACCOUNT_TYPE selected is NOT Other on the Option Changed event of the Combobox or something...

if(ACCOUNT_TYPE != "Other") SERVICE_USERNAME = ACCOUNT_TYPE;

Any help would be greatly appreciated.

Thank you, Martin