in reply to Killing processes in Win32...?

It's probably a security thing. A script run on the command line can't kill a "system" program. However, you can run the script under a system account, itself. Having one service kill the other is probably going to work if they both are configured the same way.

Do you have to kill the web server, or can you "net stop" it? That worked for me when PerlScript started hanging. I implemented a trivial loop that would test every few minutes and restart the sever if it seemed to be stuck.

—John

Replies are listed 'Best First'.
(tye)Re: Killing processes in Win32...?
by tye (Sage) on Jun 21, 2001 at 00:05 UTC

    Actually, there is no privlege that allows killing of services (nor other system processes). You have to "stop" services. But if they won't go away when asked to stop, then you can force the process to exit by using the process debugging API to attach a thread to the process and then tell the thread to execute invalid code. I think the code for this can be found in the MS knowledge base.

            - tye (but my friends call me "Tye")
Re: Re: Killing processes in Win32...?
by rrwo (Friar) on Jul 03, 2001 at 19:54 UTC

    If the user has System or Admin privs, it shouldn't be a security issue. The command-line <kbd>kill</kbd> utility that comes with the Resource Kit can kill the services (you have to kill <kbd>inetinfo.exe</kbd> and <kbd>mtx.exe</kbd>).

    Naturally one does not want to try running shell commands from a service (I was thinking of using Win32::Daemon).

    Sometimes something crashes the inetnet service, so it does not respond to <kbd>net stop</kbd>... otherwise I'd not need to ask the question.

      Did you ever get anywhere with this? I am trying to do the same thing. I want to connect to a remote server and kill inetinfo.exe if net stop w3svc fails and also restart it without using something like WRSHDNT. If you have any info, i would greatly appreciate it. Thnx ~Ray~