How can I use stop-process to stop a process tree?
-
Saturday, July 28, 2012 1:57 PMI have an old .bat file that I'm trying to convert to PowerShell. I know the PID of a running process which itself has spawned a child process for which I do not know the PID. Sometimes the child process gets hung and I'm working separately to figure out why, and correct that issue. But, meanwhile, I want to stop the entire process tree. In the .bat file, I use "TASKKILL /PID <pid> /T" to do the deed. But I'm too new to PowerShell to figure out how to do anything more than stop the parent process, which leaves the child process hung/running. I suspect I can somehow pipe get-childitem to stop-process, but can't seem to figure out the correct syntax. Can you help me?
All Replies
-
Saturday, July 28, 2012 3:26 PMModerator
The taskkill.exe program still works fine from within PowerShell.
Bill
- Marked As Answer by CharlieWright Saturday, July 28, 2012 7:34 PM
-
Saturday, July 28, 2012 7:34 PMThat was too easy. I guess I need to stop over-thinking this stuff. Thanks.

