Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a Replacement for RunServices registry key? 1

Status
Not open for further replies.

barkerj

Programmer
Nov 4, 2002
14
AU
We are finally moving to XP and have been busy getting our programs XP compliant. Previously we had our software on Win95 machines. For critical business reasons we have historically used the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices registry key to enable the software to start prior to user login. However, from what I can tell, RunServices is not supported under XP. I have tried using Run but the software only starts after a user has logged in which is way too late in the piece. Surely, there must be a way I can get the software to start without requiring a user having to log in first.
Does anyone know of a way I can do this?
 
There are several run points under XP.

win.ini Run
win.ini Load
NT User Run (win.ini map)
NT User Load (win.ini map)
All Users Run
All Users Run Once
All Users Run Service
All Users Run Service Once
Users Run
Users Run Once
Users Run Service
Users Run Service Once
All Users Startup Menu
Users Startup Menu

You would need to set Group Policy to relax the restriction that only members of the Group Administrators are permitted to initiate and run a service.

But under XP the better choice would be to use a service wrapper. This allows nearly anything, including a true service, to be initiated at startup just like any other Windows Service.

You can use the Win2k SDK tool instsvc to run an application as a service. This tool and other service utilities can be downloaded from Microsoft.

The advantages of this approach:

1. A service will start when the computer does (if you set it to "automatic") instead of when you login. Having to login, especially on a server, can be a bad thing. A service will also survive a logoff.
2. You can run a service in the background, such that a user can use the machine while the service is running, and not be bothered with it, nor able to end it without Admin access.
3. A service can be run as a user other than the one currently logged into the machine, so if the program must be run with Admin or similar access, you need not leave the machine logged in under such a user.

Or you can use FireDaemon, an inexpensive Third-Party Tool to handle the Service wrapper for you:
"What Is It?
FireDaemon is a utility that allows you to install and run virtually any native Win32 application or script (eg. BAT/CMD, Perl, Java, Python, TCL/TK) as a Windows NT/2K/XP/2K3 service. FireDaemon features easy configuration (via GUI or XML), a low memory/CPU overhead, subprocess prioritisation, custom environments, CPU binding plus monitoring and logging to the event log and on-disk log files."

Src:
 
I thought it might be helpful to you to see the load order for the run keys. Here is a good listing of the runs that occur before and after logon:

 
(sorry, was distracted.)



RunServiceOnce subkey : designed to start service programs before user logs on and before other registry subkeys start.
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce registry key
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce registry key

RunServices subkey : loads immediately after RunServicesOnce and before user logon.
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices registry key
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunServices registry key

Run subkey : The Run subkey in HKLM runs immediately before the Run subkey in HKCU.
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run registry key
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run registry key

RunOnce subkey : primarily used by Setup programs. The HKLM subkey version of RunOnce runs programs immediately after logon and before other registry Run entries. The HKCU subkey version of RunOnce runs programs after Run subkeys and after the Startup folder.
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce registry key
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce registry key XP also has RunOnceEx:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnceEx registry key

RunOnce\Setup subkey : specifies programs to run after the user logs on

Explorer\Run subkey :
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run registry key
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run registry key

Userinit subkey : there is an entry for userinit.exe but subkey can accept multiple comma- separated values. Can't find where program starting? Look here.
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit registry key
load subkey :
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows\load registry key

All Users Startup folder : very common place to find autostart programs for whoever logs on
Documents and Settings\All Users\Start Menu\Programs\Startup folder

Startup folder : the most common location for programs to automatically boot from
Documents and Settings\user\Start Menu\Programs\Startup folder If you migrated from NT, the path is Profiles\user\Start Menu\Programs\Startup
 
Thanks bcastner for your time trying to help me with this one.

My biggest problem is that, with regards to the order in which the registry keys are run, the RunServices key no longer exists under Win XP (which is a shame). I have tried the firedaemon software that you mention but regardless, I can still only get the application to become visible to the user once they have logged in to the system.

I have also tried using the Task Schedular software that comes with Windows but soon realised that the app is not visible to the user (I have looked at Micosoft's site and have not been able to find a way around this...It's just the way it is).

While my problem has not yet been solved I appreciate your replies to my question. To me they were worthy of an Expert rating regardless. I have certainly learnt a few things which I can keep under my belt for next time.

I think I will pass this problem over to the guys responsible for developing our SOE here as I am thinking they have somehow placed certain restrictions on the services etc that can be run prior to logon.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top