Jump to content

How to Delete a specific Child Process running under a Parent Process using VBscript

Recommended Posts

Is this possible? I want to target a specific process name running under its parent and nothing more.I figured this would work:

Function KillProcessInProcess()strComputer = "."Set objWMIService = GetObject("winmgmts:" _    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")Set colProcessList = objWMIService.ExecQuery _    ("SELECT * FROM Win32_Process WHERE Name = 'CcmExec.exe' OR Name = 'wscript.exe'")For Each objProcess in colProcessList    objProcess.Terminate()NextEnd Function

The problem is it will also kill all other wscript.exe process running as well as the CcmExec.exe process itself for some reason during our SMS deployment.We just want the single wscript.exe child process running under CcmExec.exe to be killed. Its PID will be random so no sense doing it via PID. Anyone have a solution? Thank you Community!!!

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...