Specifies a service's security context, which defines its logon type.
Assembly: System.ServiceProcess (in System.ServiceProcess.dll)
An account that acts as a non-privileged user on the local computer, and presents anonymous credentials to any remote server.
An account, used by the service control manager, that has extensive privileges on the local computer and acts as the computer on the network.
An account that provides extensive local privileges, and presents the computer's credentials to any remote server.
An account defined by a specific user on the network. Specifying User for the ServiceProcessInstaller.Account member causes the system to prompt for a valid user name and password when the service is installed, unless you set values for both the Username and Password properties of your ServiceProcessInstaller instance.
Use the ServiceProcessInstaller to specify the security context of the service you are installing. The security context indicates the privileges a service has on the system and how the services act on the network (for example, whether the service presents the computer's credentials or anonymous credentials to remote servers). The enumeration provides a range of privileges so that you can specify exactly the privileges you need for any particular service.enumeration when you initialize a
The LocalSystem value defines a highly privileged account, but most services do not require such an elevated privilege level. The LocalService and NetworkService enumeration members provide a lower privilege level for the security context.
The values LocalService and NetworkService are available only on Windows XP and Windows Server 2003 family.
The following code example demonstrates how to use theenumeration to install new programs by using the system account's security context.
Imports System Imports System.Collections Imports System.Configuration.Install Imports System.ServiceProcess Imports System.ComponentModel <RunInstallerAttribute(True)> _ Public Class MyProjectInstaller Inherits Installer Private serviceInstaller1 As ServiceInstaller Private serviceInstaller2 As ServiceInstaller Private processInstaller As ServiceProcessInstaller Public Sub New() ' Instantiate installers for process and services. processInstaller = New ServiceProcessInstaller() serviceInstaller1 = New ServiceInstaller() serviceInstaller2 = New ServiceInstaller() ' The services will run under the system account. processInstaller.Account = ServiceAccount.LocalSystem ' The services will be started manually. serviceInstaller1.StartType = ServiceStartMode.Manual serviceInstaller2.StartType = ServiceStartMode.Manual ' ServiceName must equal those on ServiceBase derived classes. serviceInstaller1.ServiceName = "Hello-World Service 1" serviceInstaller2.ServiceName = "Hello-World Service 2" ' Add installers to collection. Order is not important. Installers.Add(serviceInstaller1) Installers.Add(serviceInstaller2) Installers.Add(processInstaller) End Sub Public Shared Sub Main() Console.WriteLine("Usage: InstallUtil.exe [<service>.exe]") End Sub End Class
Available since 1.1