End Program - Change Default Behaviour

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Sometimes, during reboot, programs on my Windows XP SP2 machine will fail to
terminate, prompting an "End Program" dialog from Windows. This in itself is
no problem, however, when rebooting the machine from remote desktop it will
end the Terminal Services service before halting at one of those dialogs.

I'm aware of the possibility of using shutdown -f -r, however, I'd like this
to become the default windows behaviour: If it can't end the program
normally, terminate it without waiting for user input. Is this behaviour
configurable, and, if so, where and how?
 
I know of no built in way that Windows can be set to stop using this graceful
way to terminate a process or task. There are several ways to write a script
that would detect the "End Program" title bar of the dialog, and send the
keystroke that ended it.
-example.vbs--
set shell=createobject("wscript.shell")
while not shell.appactivate("End Program")
wscript.sleep 2000
wend
shell.sendkeys "{ENTER}"
-end file--
 
Thank you for your reply, however, I've done some more digging since posting
this message. Since the MMC provides the functionality to remote reboot other
machines, including the function to auto-kill all apps, I figured there had
to be something in the registry to allow for this behaviour. And there
appears to be.

The registry key "HKCU/Control Panel/Desktop" contains the value
"AutoEndTasks" which is set to 0 by default. I've now changed this to 1, and
will see how things turn out.

On a further note, the same key also contains values for
"WaitToKillAppTime", set to 20000 (milliseconds, I figure), and
"HungAppTime", set to 5000. I think the "HungAppTime" value is the timeout
used when trying to activate / kill / do another operation on an application
manually, or through the task manager, prompting the normal "Program not
responding: End now / Continue" dialog. The "WaitToKillAppTime" is, I think,
the timeout used during shutdown, i.e, the blue progress bar you get before
the final, blocking "End Program / Cancel" dialog. I'll probably double that
value, it would facilitate more graceful exits if programs can exit before
the timeout, and the "AutoEndTasks" will (probably) shoot down the remaining
stray that dares to stand in the way of my remote reboot. Problem is, the
only way I'm gonna see if I succeeded is if the machine again fails to reboot
after these changes... Which would mean unavailability for yet another day.

If all else fails, I'll build a script based on your example. Just one
question though... What are the chances that windows will shut down that
script before prompting to kill a few other programs, just like windows shuts
down the remote desktop service too early for me to be able to kill them
remotely?

Regards,

Mac
 
Back
Top