Here's a solution on how to configure Windows to automatically log on as Administrator and then start ColdFusion MX from the commandline using the batch file, all without any required user interaction. This solution is a response for a customer wishing to have this configuration so that when their machine enters a scheduled reboot overnight it can start itself in a manner that allows ColdFusion to run in a mode that will permit taking a thread dump at a later time when a user is around. To rephrase, the only value of this configuration is to be able to start ColdFusion in console mode after a machine reboot when no one is around.

Note that configuring Windows to automatically login as an Adminstrator account is a very serious security hazard and you probably shouldn't do this unless the machine is in a locked server room and you hold the keys, and there may be other security risks I hadn't thought of. However, it can be done. I don't know how to automatically lock the screen while the Administrator is automatically logged in, but if you know then please add a comment. In order for the cfstart.bat file to run in an interactive mode such that someone can come along and hit CTRL+BRK to generate a thread dump, a user must be logged in so that the console is accessible. The screen can be locked, but the user can't log off.

To get started, I followed the instructions listed in this Microsoft article on how to use AutoAdminLogon. This article assumes the following name/value pairs are set in the Windows Registry:

  • AutoAdminLogon
  • DefaultDomainName
  • DefaultUserName
  • DefaultPassword


However, I found that my system did not have the entry for DefaultPassword so I created it and entered the password in clear text, which the article mentions should be that way. Having AutoAdminLogon set to 1, and DefaultDomainName, DefaultUserName, & DefaultPassword all set, I rebooted the machine and confirmed that it automatically logged me on. Whenever tampering with the Windows Registry, be sure to make an export of either they individual key or the whole Registry first to use as a backup.

Then I created a new bat file in C:CFusionMX7in called cfstart_output.bat. The only entry in this bat file was
cfstart.bat >> cfstart_outputfile.txt. Then I dragged the the cfstart_output.bat file to the Start menu in
Start > Programs > Startup. Programs in Startup will run as soon as a user logs in.

The ColdFusion MX 7 Application Server Service should be set to Manual or Disabled if you're planning to start while using the bat file.

Rebooting the system, I found it automatically logged me on and started ColdFusion MX 7 on the commandline, but since output was being appeneded to a file the console window remained blank. I tested CTRL+BRK a couple times, then used CTRL+C to stop the ColdFusion console window. I then examined the cfstart_outputfile.txt file to confirm that it did contain 2 thread dumps.

Again, this is a very insecure configuration so think twice before doing this. But if you're ok with this, it will work.

See also:
An easier way to take ColdFusion Thread Dumps