Run a process and kill it if it gets stuck


David Trimboli

I'm currently using PSINFO.EXE from the PsTools from SysInternals to gather
information about the computers on our domain. I'm checking each computer
that shows up in NET VIEW.

Occasionally, PSINFO will get stuck on a computer, and will never finish.
Right now, I'm listing each computer as it is checked, giving it a time
stamp, and watching the clock. If a computer sticks around for a long time,
I kill the PSINFO process and the script continues.

What I'd like to do is find a way to add a timeout to the script. "Run
PSINFO. If this invocation doesn't end after two minutes, kill the

I was looking into having the script spawn another script which would simply
keep an eye on PSINFO (with PSLIST!) and kill it if its elapsed time
exceeded a certain value. This was crashing my system. I suspect I could
prevent that by only allowing the watchdog program to check once every 30
seconds, using SLEEP.EXE.

Is there an easy way to do this, or do I need to develop that second,
monitoring script?

Stardate 3659.4


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question