Windows Service Installation with a Service User Account

While installing a windows service I wrote this command in my installation script (not using the installutil.exe) and used a service user account.

 

SC.EXE create MyService binPath= "%CD%\MyService.exe" start= auto obj= "domain\Myserviceuser" Password= "AbcD12345" DisplayName= "My Service"

SC.EXE DESCRIPTION MyService  "My Alert Service"

NET START MyService

 

During installation I got the below error and the service failed to start though it got installed.

System error 1069 has occurred.

The  service  did not start due to a logon failure.

logon failed due to missing ntrights

When I added the username and password manually to the service and started it manually it worked fine.

Then I modified the installation script and added the following command before creating the service which worked fine in installing and starting the service from the package itself.

ntrights.exe -u Myserviceuser +r SeServiceLogonRight

 

The command ntrights grants the Logon as a service rights to the user.

 

You can find this article in the link BeyondRelational

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s