From: Jonathan on
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
From: Bishop on
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

From: Jonathan on
On Jul 2, 3:12 am, Bishop <Bis...(a)discussions.microsoft.com> 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.
From: Bishop on
"Jonathan" wrote:

> On Jul 2, 3:12 am, Bishop <Bis...(a)discussions.microsoft.com> 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