One of the great advantages to having an application that runs as a service is that you can be sure that when the system boots or reboots, the service will load without any effort on your part.
However, there are many circumstasnces where you would like something to happen at boot time that cannot normally be loaded as a service. Maybe you need to run a script or batch file, a Java application, or some other type of software that is not optimized to run as a service. What you usually end up doing in these cases is logging into the system manually, running the script or application, and then locking the workstation. If a server reboots at 3am on a Sunday, then I hope you left your pager on!
Fortunately, there is an alternative. One of the most valuable (and least publicized) tools in the Win2k Resource Kit is a little service called AutoExNT. When this service is run, it looks in the system32 directory for a batch file called autoexnt.bat. It runs this batch file, then shuts itself off. Thus, you can script virtually any activity to occur on your remote server or workstation at boot time. No manual intervention is required.
There are uses for AutoExNT in circumstances other than boot time. Since it stops itself on completion, you could set this service to manual and use it as a simple trigger for complex scripts on the remote server. Just start the service remotely and the script will run. When the service stops you can do it all over again.
This was first published in December 2001