Pskill not working on VBS script

On the next VBS script, pskill seems not to be working, see the error returned attached, and this is the code. i think it has to do with the declaration of wshShell?? But im not sure.

error vbs
Option Explicit
Dim objWMIService, objProcess, objFSO, objTextFile
dim colProcess,colServices, colItems
dim objItem, objService
Dim strComputer, strProcessKill, strProcessMem
Dim memLimit, processMem
Dim mustKill
strComputer = "."
strProcessKill = "'DLLHOST.EXE'"
strProcessMem = "'DLLHOST'"
memLimit = 10000
mustKill = 0
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = " & strProcessKill )
dim intRC
For Each objProcess in colProcess
    msgbox "Pid is..." & ObjProcess.ProcessId
    processMem = objProcess.WorkingSetSize/1024
    msgbox "Size is " & processMem
                If processMem >= memLimit Then
                   MsgBox "is more than" & memLimit & " Kb"
       mustKill = 1
                   MsgBox "is less than " & memLimit & " Kb"
                End If    
    if mustKill = 1 then
        msgbox "im gonna kill it"
	wshShell.Run "cmd /k C:\pskill.exe -accepteula ObjProcess", 1, True
	if intRC = 0 Then
           msgbox "Successfully killed process."
           msgbox "Could not kill process. Error code: " & intRC
        end if
    end if

Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile ("c:\informe_dllhost.txt", ForAppending, True)
if mustKill = 1 then    
    objTextFile.WriteLine(now & vbnewline & " Process has been killed with " & processMem & " Kb" & vbnewline & vbNewLine)
end if

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NVITEnd-user supportCommented:
Add this above line 9:
Set WshShell = WScript.CreateObject("WScript.Shell")

Open in new window

celticianAuthor Commented:
It doesn't find the process, i guess the command line is not getting right the process id. It opens up a cmd window (right) however it gets instead the error in the next capture:pskill cmd
celticianAuthor Commented:
I ugess the error must be in line 33, i dont know what parameter send to the cmd that will evoke the pskill:

      wshShell.Run "cmd /k C:\pskill.exe -accepteula ObjProcess", 1, True
NVITEnd-user supportCommented:
ObjProcess is being passed incorrectly as a string. Change to:

wshShell.Run "cmd /k C:\pskill.exe -accepteula " & ObjProcess, 1, True

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.