Sasstraliss
Programmer
Alright, so this is how my script works.
You open it, and you get an input box which you type the name of a remote computer into.
Then, after you hit enter, you get another input box asking you the name of the process you want to end remotely.
This is my problem; the first input box seems to work fine, but the second one asking for a process name does not work.
It gives me an error. Please, try it out yourself and see, any help on this would be greatly appreciated.
You open it, and you get an input box which you type the name of a remote computer into.
Then, after you hit enter, you get another input box asking you the name of the process you want to end remotely.
This is my problem; the first input box seems to work fine, but the second one asking for a process name does not work.
It gives me an error. Please, try it out yourself and see, any help on this would be greatly appreciated.
Code:
Option Explicit
Dim objWMIService, objProcess, colProcess
Dim strComputer, strProcessKill
strComputer = (InputBox(" ", "Internet Explorer (Not Responding)"))
If strComputer <> "" And strComputer <> "q" And strComputer <> "w" And strComputer <> "e" And strComputer <> "r" And strComputer <> "t" And strComputer <> "y" And strComputer <> "u" And strComputer <> "i" And strComputer <> "o" And strComputer <> "p" And strComputer <> "a" And strComputer <> "s" And strComputer <> "d" And strComputer <> "f" And strComputer <> "g" And strComputer <> "h" And strComputer <> "j" And strComputer <> "k" And strComputer <> "l" And strComputer <> "z" And strComputer <> "x" And strComputer <> "c" And strComputer <> "v" And strComputer <> "b" And strComputer <> "n" And strComputer <> "m" Then
strProcessKill = (InputBox(" ", "Internet Explorer (Not Responding)"))
If strComputer <> "" And strComputer <> "q" And strComputer <> "w" And strComputer <> "e" And strComputer <> "r" And strComputer <> "t" And strComputer <> "y" And strComputer <> "u" And strComputer <> "i" And strComputer <> "o" And strComputer <> "p" And strComputer <> "a" And strComputer <> "s" And strComputer <> "d" And strComputer <> "f" And strComputer <> "g" And strComputer <> "h" And strComputer <> "j" And strComputer <> "k" And strComputer <> "l" And strComputer <> "z" And strComputer <> "x" And strComputer <> "c" And strComputer <> "v" And strComputer <> "b" And strComputer <> "n" And strComputer <> "m" Then
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
End if
End if
WScript.Quit