Jump to content

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


thudo
 Share

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 comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...