Windows Vista Forums

Terminate process issue
  1. #1


    Jonathan Guest

    Terminate process issue

    I have a very simple script that I'm testing out to include in a much
    larger script, it is a very simple terminate process request for
    DLLHOST.EXE or dllhst3g.exe.

    The script runs with no errors but it just not terminate the process,
    can anyone tell me what I'm missing here:

    Option Explicit
    Dim objWMIService, objProcess, colProcess
    Dim strComputer, strProcessKill
    strComputer = "."
    strProcessKill = " 'dllhst3g.exe' "

    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")

    Set colProcess = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = " & strProcessKill )
    For Each objProcess in colProcess
    objProcess.Terminate()
    Next
    WScript.Echo "Just killed process " & strProcessKill _
    & " on " & strComputer
    WScript.Quit



      My System SpecsSystem Spec

  2. #2


    Bishop Guest

    RE: Terminate process issue

    I think it's a security problem.
    If you have enough rights try this sample:

    http://www.scriptbox.at.tt/index.php?search=Kill Process under a different
    security context.vbs&site=1


      My System SpecsSystem Spec

  3. #3


    Jonathan Guest

    Re: Terminate process issue

    On Jul 2, 3:12*am, Bishop <Bis...@xxxxxx> wrote:

    > I think it's a security problem.
    > If you have enough rights try this sample:
    >
    > http://www.scriptbox.at.tt/index.php?search=KillProcess under a different
    > security context.vbs&site=1
    I am running the script as Administrator (my username also is part of
    the Administrators GP).

    The link you provided takes me to a relatively empty page (and yes I
    did paste the second line into the link also)

    I believe the problem may have more to do with the fact that DLLHOST
    and dllhst3g processes are COM + surrogates and as such cannot be
    killed normally but I don't know where to go from here.

      My System SpecsSystem Spec

  4. #4


    Bishop Guest

    Re: Terminate process issue

    "Jonathan" wrote:

    > On Jul 2, 3:12 am, Bishop <Bis...@xxxxxx> wrote:

    > > I think it's a security problem.
    > > If you have enough rights try this sample:
    > >
    > > http://www.scriptbox.at.tt/index.php?search=KillProcess under a different
    > > security context.vbs&site=1
    >
    > I am running the script as Administrator (my username also is part of
    > the Administrators GP).
    >
    > The link you provided takes me to a relatively empty page (and yes I
    > did paste the second line into the link also)
    >
    > I believe the problem may have more to do with the fact that DLLHOST
    > and dllhst3g processes are COM + surrogates and as such cannot be
    > killed normally but I don't know where to go from here.
    >

    Sorry, i hope this link works better:
    http://www.scriptbox.at.tt/index.php?character=K&site=1

    If not, here is the content of the Script:

    Option Explicit

    Dim strComputer : strComputer = "."
    Dim strProcessName : strProcessName = "notepad.exe"
    Dim oWMIService : Set oWMIService = GetObject("winmgmts:" &
    "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

    oWMIService.Security_.ImpersonationLevel = 3
    oWMIService.Security_.privileges.addasstring "SeDebugPrivilege", True

    Dim colProcessList : Set colProcessList = oWMIService.ExecQuery("Select *
    from Win32_Process Where Name = " & Chr(34) & strProcessName & Chr(34))
    Dim oProcess

    For Each oProcess in colProcessList
    oProcess.Terminate()
    Next

    Set oWMIService = Nothing
    Set colProcessList = Nothing




      My System SpecsSystem Spec

Terminate process issue problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wait already running process to terminate ? Vilius Mockûnas VB Script 2 21 Aug 2009
Process priority issue Malart General Discussion 0 16 Jan 2009
CTP3, new cmdlet Start-Process issue Roman Kuzmin PowerShell 4 30 Dec 2008
How to terminate a Win32 process without using "winmgmts:" Smoreno VB Script 4 11 Oct 2008
Terminate Process Problem with Option Explicit Breaks functionality Jeff Lynch VB Script 2 06 Jul 2008