Where is the DESCRIPTION property for a Windows Service?

  • Thread starter Thread starter Tolga Balci
  • Start date Start date
T

Tolga Balci

I've been creating and installing Windows Services, but my services never
display a "Description" in the computer management console.

The DisplayName I specify with the ServiceInstaller class works great to
display the friendly name of the service in the computer management console
and I figured the same class should also have something like a
DisplayDescription, but no luck.

How do I specify desciptions for my services?
 
Tolga -

You gotta put it in the registry yourself by overriding the INSTALL
and UNINSTALL in your PROJECT INSTALLER:

Imports Microsoft.Win32

Public Overrides Sub Install(ByVal stateSaver As
System.Collections.IDictionary)
Dim system As RegistryKey
Dim currentcontrolset As RegistryKey
Dim services As RegistryKey
Dim service As RegistryKey
Dim config As RegistryKey
Try
MyBase.Install(stateSaver)
system = Registry.LocalMachine.OpenSubKey("System")
currentcontrolset = system.OpenSubKey("CurrentControlSet")
services = currentcontrolset.OpenSubKey("Services")
service = services.OpenSubKey(Me.ServiceInstaller1.ServiceName,
True)
service.SetValue("Description", "Here is where you put your full
description")
Catch ex As Exception
Console.WriteLine("An exception occurred during service
installation:" & vbCrLf & ex.ToString())
End Try
End Sub

Public Overrides Sub Uninstall(ByVal savedState As
System.Collections.IDictionary)
Dim system As RegistryKey
Dim currentcontrolset As RegistryKey
Dim services As RegistryKey
Dim service As RegistryKey
Try
system = Registry.LocalMachine.OpenSubKey("System")
currentcontrolset = system.OpenSubKey("CurrentControlSet")
services = currentcontrolset.OpenSubKey("Services")
service = services.OpenSubKey(Me.ServiceInstaller1.ServiceName,
True)
service.DeleteValue("Description", False)
Catch ex As Exception
Console.WriteLine("An exception occurred while uninstalling
service:" & vbCrLf & ex.ToString())
Finally
MyBase.Uninstall(savedState)
End Try
End Sub

HTH - Best Regards, Lee Gillie, Spokane WA
 
Back
Top