cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sandwich
Level 4

Service won't start until after reboot when running under Local System Account

I am trying to eliminate a forced reboot from one of our installers.
This particular installer installs a service and we put up a dialog where the user may enter a username/password and domain to log into and run this service. If the user chooses to enter this information with good credentials the installer does not need to reboot at all and the service will run just fine.
However, if the user chooses not to enter un/pw and domain we warn the user and then cause the service to log in and run under the 'Local System Account'.
At the end of the installation when we attempt to log into the service we will throw an error because the start up of the service fails. Prior to rebooting I go to services and try to start up the service manually and get the following error message:
"The "______" service on Local Computer started then stopped. Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service."
Now if I reboot the machine the Local System account can log in and run the service successfully. (No Errors)
So I know providing a valid UN/PW and Domain will get the service up and running without reboot but the LocalSystem user will not.
I would appreciate any help with this. Thanks in advance.
Labels (1)
0 Kudos
(7) Replies
TheTraveler
Level 8

Got a couple of questions for you:
1) What installation project are you using?
2) How are you adding the service to the system? ServiceAddService?
3) How are you starting the service? ServiceStartService?
0 Kudos
sandwich
Level 4

Sorry should have mentioned it was an InstallScript project.
The Service is added and started outside of InstallShield by two C++ functions. I am not sure why ServiceStartService and ServiceAddService were not used. This installer has been around for years. I took it over about a year ago. Originally it needed to support 95 and 98 so maybe that is why it was handled this way. Do you think the problem I am seeing would go away if I used the two functions you refer to?
0 Kudos
TheTraveler
Level 8

I understand. I too used a C++ DLL to do exactly the same thing. I abandoned the DLL in favor of the ServiceAddService Functions. Install Shield (IS) has evolved greatly since the 95 and 98 days. Anyway, who is using 95 and 98 these days??? Aren't those two operating systems no longer supported by Microsoft???

I do recommend using the new functions from IS. I don't know if your problem will go away, but it wouldn't hurt to try them. The functions are extremely simple to use.
0 Kudos
sandwich
Level 4

Yeah the 95 or 98 was needed way back when....which we haven't supported in a long time, but there was never a reason to change the way we were adding or starting a service so here we are.

Thanks for your help, I will give the functions you mentioned a shot.
0 Kudos
TheTraveler
Level 8

Please let me know what happens. If you need sample code, I'm willing to provide...
0 Kudos
JesseBearden
Level 5

Did you ever resolve this? I'm having this issue, but only on XP. On 2003 the service starts fine without a reboot.

I'm quite certain the service is being installed correctly, but just for completeness sake, it is a .NET service that depends on the GAC and is therefore added and started in a custom action after InstallFinalize.
0 Kudos
sandwich
Level 4

I was not able to resolve this though I did improve how the installer was handling the issue.
If the user passed in a good UN/PW and Domain the installer no longer reboots.
If the user does not enter a good UN/PW and Domain the "LocalSystem" user logs in by default. When the installer sees LocalSystem is the logged in user it forces a reboot at the end of the install.
More often than not our customers do not use LocalSystem. So I have greatly reduced the number of reboot but not eliminated them.
0 Kudos