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.
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
This command grants the Logon as a service rights to the user.
Published under: Microsoft .NET Tips · · · ·