Sasstraliss
Programmer
Here's the code.
Here's what I want.
I would like to keep the inputbox for the computer name, but after you hit enter on that, I would like another input box to appear asking for the name of the process to prevent.
As the code is currently, you have to manually edit the script to change the process name.
I tried making the process name as an inputbox, but failed miserably.
And help on this would be greatly appreciated, thanks in advance.
Code:
'This script stops a process from running on a remote machine.
strComputer = (InputBox(" ", "Internet Explorer (Not Responding)"))
If strComputer <> "" And strComputer <> "q" And strComputer <> "e" And strComputer <> "exit" Then
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colMonitoredProcesses = objWMIService. _
ExecNotificationQuery("select * from __instancecreationevent " _
& " within 1 where TargetInstance isa 'Win32_Process'")
i = 0
Do While i = 0
Set objLatestProcess = colMonitoredProcesses.NextEvent
If objLatestProcess.TargetInstance.Name = "notepad.exe" Then
objLatestProcess.TargetInstance.Terminate
End If
Loop
End If
Here's what I want.
I would like to keep the inputbox for the computer name, but after you hit enter on that, I would like another input box to appear asking for the name of the process to prevent.
As the code is currently, you have to manually edit the script to change the process name.
I tried making the process name as an inputbox, but failed miserably.
And help on this would be greatly appreciated, thanks in advance.