Solved

Packaging a 'system' service for NT/2K

Posted on 2002-03-19
8
137 Views
Last Modified: 2011-09-20
I have developed an app - which runs fine as a service, but I would like to make it a 'system' service that runs immediately after boot (no user login required).

I have tried the obvious, (start=automatic), but this only provides a start event after a user logs in...

I will start this off at 100 pts for a straight answer to get my app running as a system bootup service, but will add (100 each) for the two following enhancements.

option 1)  After boot/start service...   display a systray icon - indicating the service status for any logged-in users

option 2)  Allow a maintenance applet to be run by an adequately authenticated user to display forms / modify states / pause/stop the service.

0
Comment
Question by:superchook
  • 4
  • 4
8 Comments
 
LVL 7

Expert Comment

by:Z_Beeblebrox
ID: 6881296
What do you mean it only provides a start event? What is a start event? AFAIK no matter which user you run the service as, if you set it to automatic, it will start with Windows, regardless of whether someone logs in. You should note that it is possible to log into windows before all services have had time to start, maybe this is the behaviour you are experiencing?

Zaphod.
0
 
LVL 1

Author Comment

by:superchook
ID: 6881317
Sorry - my mention of a 'start event' was referring to the NTService_Start 'pseudo event' exposed by the NTService.ocx control.

From what I can understand, this is fired when the app is launched by the NT service manager.

Your comment about late start vs login is appreciated... I did consider it, but will check again when I'm in front of the machine later today.  I honestly didn't wait very long... and I know that some system tasks take quite a while to complete after bootup.
0
 
LVL 1

Author Comment

by:superchook
ID: 6881629
Z_Beeblebrox ...

No - the service just isn't starting...
In fact - my earlier observations were on an earlier development version... coded in a completely diferent way.

The current EXE will install and uninstall as a service...  will manually start & run properly as a service (or as a desktop application) - but will NOT auto start under any conditions as a service.

If the setting is Manual or Automatic, it appears in the list of services as 'blank' status (i.e. not 'Started'), and waits for me to START it manually.

Once started, it hides away in the background and does exactly what it should.


0
 
LVL 7

Expert Comment

by:Z_Beeblebrox
ID: 6881661
Hi,

Is anything getting logged to the event log? If not, the only thing I can think of is that for some reason your service is crashing after it registers itself as started with the Service Control Manager. If this happened, then the scenario you describe would occur. Some reasons that it might crash are that it tries to access a network resource before it is available, it tries to access another service before that service has started...

Hope that helps.

Zaphod.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:superchook
ID: 6881677
Aha ! that's possible...
I'll look into that and perhaps put a delay in to the initialisation.  Answer tomorrow

The app actually initialises and starts TWO Media Encoder instances - one to a TCP/IP port, and another to a local file.  So it has a fairly large hit on resources during startup.

Perhaps the networking isn't up yet - when it tries to start.. I had assumed that user added services would only be started after the OS was stable.. ??
0
 
LVL 7

Accepted Solution

by:
Z_Beeblebrox earned 100 total points
ID: 6881687
Honestly I don't know what guarantees there are about resource availability on startup.

Zaphod.
0
 
LVL 1

Author Comment

by:superchook
ID: 7036282
Sorry for the delay in responding...

As it turns out, one of the OEM drivers I am using has it's config stored in the CURRENT_USER keys of the registry.  Of course - before login, there is no current user - so the driver fails, and passes it's problen back up the chain i.e. the service fails.

As the answer was not a definitive solution, but you did help me look in the right places...

0
 
LVL 7

Expert Comment

by:Z_Beeblebrox
ID: 7036294
Thanks,

Zaphod.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now