G
Guest
I am trying to write a script and it give me an error, the error
code is (null): 0x80041017. I looked at the TechNet site and it
says that its that the
"WBEM_E_INVALID_QUERY
0x80041017
Query was not syntactically valid."
I am copying my code down here. Please Script Gurus go thru
my script and let me know where I am messing up. I am still
trying to figure it out, if I can find where I am making a mistake
then I will let you know.
Here is my code listing.
TestKill.vbs
=================
Option Explicit
Dim objWMIService, objProcess, colProcess
Dim strComputer, strProcessKill, strProcess
strComputer = InputBox("What computer do you want to check?"_
& vbCrLf & vbCrLf & "Please enter a Computer name or IP",
"Which Computer?")
If strComputer = "" then
WScript.Echo "No Input...quitting"
Wscript.Quit
end if
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
strProcess = InputBox("What process do you want to stop?"_
& vbCrLf & vbCrLf & " Enter the process file name", "What process?")
If strProcess = "" then
WScript.Echo "No Input... quitting"
WScript.Quit
else strProcess = "'" & strProcess & "'"
end if
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Processo Where Name = " & strProcessKill )
For Each objProcess in colProcess
objProcess.Terminate()
Next
WSCript.Echo "Just killed process " & strProcessKill _
& " on " & strComputer
WScript.Quit
======================
End of listing.
Thanks,
Jiten
code is (null): 0x80041017. I looked at the TechNet site and it
says that its that the
"WBEM_E_INVALID_QUERY
0x80041017
Query was not syntactically valid."
I am copying my code down here. Please Script Gurus go thru
my script and let me know where I am messing up. I am still
trying to figure it out, if I can find where I am making a mistake
then I will let you know.
Here is my code listing.
TestKill.vbs
=================
Option Explicit
Dim objWMIService, objProcess, colProcess
Dim strComputer, strProcessKill, strProcess
strComputer = InputBox("What computer do you want to check?"_
& vbCrLf & vbCrLf & "Please enter a Computer name or IP",
"Which Computer?")
If strComputer = "" then
WScript.Echo "No Input...quitting"
Wscript.Quit
end if
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
strProcess = InputBox("What process do you want to stop?"_
& vbCrLf & vbCrLf & " Enter the process file name", "What process?")
If strProcess = "" then
WScript.Echo "No Input... quitting"
WScript.Quit
else strProcess = "'" & strProcess & "'"
end if
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Processo Where Name = " & strProcessKill )
For Each objProcess in colProcess
objProcess.Terminate()
Next
WSCript.Echo "Just killed process " & strProcessKill _
& " on " & strComputer
WScript.Quit
======================
End of listing.
Thanks,
Jiten