2

I would like to run a program before login. But not one that terminates.

It is basically a rabbitmq client that constantly polls a message queue or whatever.

The reason I want to do this is is just in case the client's server reboots, and the windows UI is in a state in which a user is not logged in, or has a prompt. I want to still have the program functioning normally. This is a limitation I have at the moment. If there is a simpler solution that eludes this problem in its entirety, please let me know.

I have tried editing the start up scripts. This worked; it ran, but it hung. I assumed it was because the program never terminates, at least normally.

Actually, just to cover my bases, the reason I want this program to start up before anyone logs in (only a single user is ever expected to log in, the admin user), is so the program can access network and the file system just in case the system should ever reboot unexpectedly, or ever hang on a login prompt, or some other prompt such as 'why did ya reboot?'

Will I even be able to access the internet and file system if I execute at this stage?

I know I can disable the power logging, thus eliminating that particular case, but I want something more fool proof.

Suppose I can access i/o, how do you do this?

I also tried using the task scheduler, however when I do this, the program never loads. I get a 'could not start' message.

I wish I could assume a state where the admin is logged in and everything is functioning, but all this UI hoohah is interfering.

Thanks, Dane

2 Answers 2

1

As Luiz mentions, you can use Window's group policy editor to launch a start script before logging in. For this technique, here's a guide with step by step instructions on how to set up a basic start up script.

Microsoft has a KB discussing how to launch a program before the shell at logon - some registry editing is required for this solution.

It's also possible to run a program as a service, using sc.exe. Here's a post with an example:

I recently came to problem, where I needed to run a program before I do login. One solution was setting up a startscript using gpedit.msc, but this needed me to disable an option which makes Windows login much faster. So I came to another solution: Run the program as service!

This is surprisingly easy: Microsoft has added a programm, called sc.exe which does this job for you. Here is an example:

sc.exe create "TrueCrypt Automount" start= "auto" binPath="C:\automount.bat" DisplayName= "TrueCrypt Automount"

If you want to start a program even earlier than that, take a look at this SU question.

0

I don't understand the real purpose. I wouldn't try to interfere with the booting process.

There are a couple of things to try on gpedit.msc. My Windows is in Portuguese, so the works may differ.

One of them is "Always wait for network at computer startup and logon". It's under "Computer Configuration/Administrative Templates/System/Logon" if I'm not mistaken.

Also, under "Computer Configuration\Administrative Templates\System\Scripts" - source:

Run logon scripts synchronously
Enable this option to force the system to run the scripts synchronously, one after another.

Maximum wait time for Group Policy scripts
Use this option to set the script timeout interval. The default interval is 600 seconds (10 minutes), and valid intervals range from 0 to 32000 seconds. This affects both computer and user scripts that run synchronously.

Reinforcing: I wouldn't try to mess with it. But it's up to you.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .