VBScript dynamicly end task - TechRepublic
Question
January 4, 2009 at 03:41 PM
1realtruth

VBScript dynamicly end task

by 1realtruth . Updated 17 years, 6 months ago

I want to end a task with a VBScript. I found several nice scripts but they are all static, you have to manually change settings for each process you want to end. That would be nice if I had to end the same processes on a bunch of computers due to a virus but it does not work well in the practicle world.

I modified a script I found and it runs nice but it always tells me the remote computer is not available. Even with it is the local computer.

Here is the code I have so far…

Dim Process,RC
Dim Hostname, ProcessQ
Dim Confirm1, Confirm2
Hostname = InputBox (“What is the Hostname or IP Address of the Server?”)
Confirm1 = MsgBox(“You typed in ” & Hostname & VbCrLf &_
“Is this correct?”, 4, “Continue?”)
If Confirm1 = vbYes Then
ProcessQ = InputBox (“What process would you like to stop?”)
Confirm2 = MsgBox(“You typed in ” & ProcessQ & VbCrLf &_
“Is this correct?”, 4, “Continue?”)
If Confirm2 = vbYes Then
End If

For Each Process in GetObject(“winmgmts:{impersonationLevel=impersonate}!\\” & “Hostname”).ExecQuery(“select * from Win32_Process where Name=ProcessQ”)
RC=Process.Terminate
Next
End If

This discussion is locked

All Comments