Below XMLCodeDemonstrate how to use serviceinstall in Wix to automatically install Windows Services
<? XML version = "1.0" encoding = "UTF-8"?>
<Wix xmlns = "http://schemas.microsoft.com/wix/2006/wi">
<Product ID = "832b8322-6349-4ddd-8ac6-cf18e7a05509" name = "dotnetservice"
Language = "1033" version = "1.0.0.0" Manufacturer = "persistent"
Upgradecode = "6493a097-ba2d-482b-9edd-2bdbc3e5463e">
<Package installerversion = "200" compressed = "yes"/>
<Media id = "1" Cabinet = "wixserviceinstaller. Cab" embedcab = "yes"/>
<Directory id = 'targetdir' name = 'sourcedir'>
<Directory id = 'gramfilesfolder 'name = 'pfiles'>
<Directory id = 'dotnetservice' name = 'dotnet'>
<Component id = "installservice" guid = 'aaa67783-EEF0-453f-BBAF-E02B1341E3BC '>
<File ID = "windowsservice" name = "wixserviceinstaller.exe"
Source = "wixserviceinstaller.exe" keypath = "yes"/>
<Serviceinstall id = "ABC"
Name = "wixserviceinstaller"
Displayname = "wixserviceinstaller"
Type = "ownprocess"
Start = "Auto"
Errorcontrol = "normal"
Description = "wixserviceinstaller"
Account = "[serviceaccount]"
Password = "[servicepassword]"/>
<Servicecontrol id = "startwixserviceinstaller"
Name = "wixserviceinstaller" Start = "Install" Wait = "no"/>
<Servicecontrol id = "stopwixserviceinstaller" name = "wixserviceinstaller"
Stop = "both" Wait = "yes" Remove = "Uninstall"/>
</Component>
</Directory>
</Directory>
</Directory>
<Feature id = 'theonlyfeature 'description = 'feature contains the single component'
Level = '1'>
<Componentref id = 'installservice'/>
</Feature>
</Product>
</Wix>
--------------------------------
From: http://avinashkt.blogspot.com/2007/05/how-to-install-windows-service-using.html