Vishweshwar Kapse
Vishweshwar Kapse

Reputation: 939

what are the differences between the account properties of ServiceProcessInstaller

Hi i am learning to create a windows service i searched a lot and did not get a clear understanding of the Account property in the ServiceProcessInstaller Class can anybody please explain what is the difference between
1.User
2.LocasService etc..

Upvotes: 2

Views: 5523

Answers (2)

Mohsen Sichani
Mohsen Sichani

Reputation: 1076

I think the best one is:

LocalService
An account that acts as a non-privileged user on the local computer, and presents anonymous credentials to any remote server.

LocalSystem An account, used by the service control manager, that has extensive privileges on the local computer and acts as the computer on the network.

NetworkService
An account that provides extensive local privileges, and presents the computer's credentials to any remote server.

User
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.

from: https://msdn.microsoft.com/en-us/library/system.serviceprocess.serviceaccount(v=vs.110).aspx

Upvotes: 2

Kevin Richardson
Kevin Richardson

Reputation: 3622

The ServiceAccount Enumeration page on MSDN has a table that describes each account.

It is best practice to use an account with the lowest privileges that is appropriate to the functionality of your service. Normally that means using the LocalService account unless you're doing something that requires the privileges of LocalSystem.

LocalSystem basically has free reign over the machine, whereas LocalService/NetworkService have roughly the same privileges of a standard user account. As you'd expect, running the service in the context of a specific user would provide the service with that user's privileges.

Upvotes: 3

Related Questions