I have created a windows service in vb.net. Is there anyway i can create an installation for it that does not require installutil to be used?
3 Answers
Installutil is necessary, but to make things easier, you can create a Setup project, so that you simply run an .msi to install the service. (This uses installutil under the hood, but it greatly simplifies installation.)
One walkthrough is here: http://support.microsoft.com/kb/816169
And another is here: http://msdn.microsoft.com/en-us/library/zt39148a(VS.80).aspx
The main difference between the two is the amount of code in the samples. They both walk you throuigh the same process.
The articles linked to are old, but still apply in VS2010. I used the second article to walk through the process for a VS2010 service just last week.

- 72,686
- 18
- 132
- 173
-
Thanks for the walkthrough. I also used the second article with great success. However within my service i have a variable called filepath, which determines the output location of the files my service creates. Is there anyway i can get the user to be able to type in the location they want? – Simon Jan 31 '12 at 21:10
-
or should i look to sintall via a .bat fle? – Simon Jan 31 '12 at 21:11
-
1You can do it if the values are in the .config file. There's a tutorial here that shows how to modify app.config values in a Setup Project install scenario. I haven't used it, but it look spromising. http://raquila.com/software/configure-app-config-application-settings-during-msi-install/ – David Jan 31 '12 at 21:24
-
You Sir, are a genius! Thanks for the link, ill have a read through now! – Simon Jan 31 '12 at 21:25
-
So not true... But thanks for the compliment, and you're welcome for the link. – David Jan 31 '12 at 21:33
-
I seem to be struggling with the part regarding the installing method. I only need to create a piece of code that sets one variable. i have asked it in another question as i feel the links on this question make for easy reading and i dont want to complicate matters. http://bit.ly/wHA2dt – Simon Feb 01 '12 at 15:38
-
The link is longer valid. I found an archive at the following location: https://www.betaarchive.com/wiki/index.php?title=Microsoft_KB_Archive/816169 – Nathan Jul 21 '22 at 21:33
Why do you want to avoid installutils?
You could try using the sc
command, as in sc create ...
EDIT: Here's an MSDN page for it: http://support.microsoft.com/?kbid=251192
DESCRIPTION:
Creates a service entry in the registry and Service Database.
USAGE:
sc <server> create [service name] [binPath= ] <option1> <option2>...
OPTIONS:
NOTE: The option name includes the equal sign.
A space is required between the equal sign and the value.
type= <own|share|interact|kernel|filesys|rec>
(default = own)
start= <boot|system|auto|demand|disabled|delayed-auto>
(default = demand)
error= <normal|severe|critical|ignore>
(default = normal)
binPath= <BinaryPathName>
group= <LoadOrderGroup>
tag= <yes|no>
depend= <Dependencies(separated by / (forward slash))>
obj= <AccountName|ObjectName>
(default = LocalSystem)
DisplayName= <display name>
password= <password>

- 12,523
- 6
- 48
- 65
-
That's a good one. I'd forgotten about that. I used that on my first service before I found out how to sue MSI files. This allows you to do things that you can't do with InstallUtil like setting the default username and password for the service to run under. +1. – David Jan 30 '12 at 20:18
-
1pay special attention to the [binPath= ] there has to be a space between the = and the start of your path. This has got me numerous times. – AndyM Jan 23 '16 at 08:35
You can always do it with registry entries.
The keys are found in HKLM\SYSTEM\CurrentControlSet\services
The key name you create is the embedded name of the service on your service handler. The following values are relevant:
DisplayName
= text that gets displayed in the services manager
ImagePath
= FQ Filename of service executable
Start
(DWORD) = startup type (3 = autostart)
DelayedAutoStart
(DWORD) = (1 = delayed)
WOW64
(DWORD) = (0 = 64-bit app, 1 = 32-bit app)
ErrorControl
(DWORD) = 0
ObjectName
= {username} to run under (LocalSystem for system account)
There are lots of other values, but that should get you started.

- 26,994
- 10
- 93
- 143

- 3,126
- 4
- 22
- 29