How to request: Powershell act as Process Explorer RRS feed

  • Question

  • Hi

    I have a Powershell script that starts an application on a Windows machine.  This application the spawns a few additional processes.  Problem is that these processes are not closed when the application has been closed.

    What I am hoping for is to add the the Powershell script the option to determine the processes and those spawned under this process.  Similar to what Process Explorer does.
    Then I would like to kill each of the spawned process after a minute or 2, once the application is closed.

    - How do I get the process information of the spawned process based on only the application that was started by Powershell?
    - How do I start the application and also allow the Powershell script to determine the processes?

    Thank you.


    Wednesday, August 9, 2017 2:26 PM

All replies

  • $process = Start-Process Notepad -passthru
    Stop-Process $process.Id

    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful. (99,108,97,121,109,97,110,50,64,110,121,99,97,112,46,114,114,46,99,111,109|%{[char]$_})-join''

    Wednesday, August 9, 2017 2:32 PM
  • Hi Mac,

    Just checking in to see if the information provided was helpful.

    Please let us know if you would like further assistance.

    Best Regards,


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Wednesday, August 30, 2017 9:02 AM