stevemarks59
Technical User
My OS is XP-Pro SP3
I use the VB Script shown below to quickly kill applications when I don't want them loading at startup. This VB Script seems to kill the applications much faster than running a batch file to start taskkill.exe. However I would rather not have to click the "OK" button prompted AFTER each application is terminated. Seems pointless anyway to be asked for an "OK" AFTER the application has been killed. Can this script be modified to eliminate the pointless prompts? I would not have ran the script in the first place if I did not want to kill the apps.
The popup window displays how many instances of the application it has killed and you have to click the "OK" button before the script will kill the next application or close.
This is the script:
strComputer = "."
strProcessToKill = "cmd.exe"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = '" & strProcessToKill & "'")
count = 0
For Each objProcess in colProcess
objProcess.Terminate()
count = count + 1
Next
wscript.echo "Killed " & count & " instances of " & _
strProcessToKill & "on " & strComputer
strComputer = "."
strProcessToKill = "firefox.exe"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = '" & strProcessToKill & "'")
count = 0
For Each objProcess in colProcess
objProcess.Terminate()
count = count + 1
Next
wscript.echo "Killed " & count & " instances of " & _
strProcessToKill & "on " & strComputer
strComputer = "."
strProcessToKill = "yahoomessenger.exe"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = '" & strProcessToKill & "'")
count = 0
For Each objProcess in colProcess
objProcess.Terminate()
count = count + 1
Next
wscript.echo "Killed " & count & " instances of " & _
strProcessToKill & "on " & strComputer
Thanks.
I use the VB Script shown below to quickly kill applications when I don't want them loading at startup. This VB Script seems to kill the applications much faster than running a batch file to start taskkill.exe. However I would rather not have to click the "OK" button prompted AFTER each application is terminated. Seems pointless anyway to be asked for an "OK" AFTER the application has been killed. Can this script be modified to eliminate the pointless prompts? I would not have ran the script in the first place if I did not want to kill the apps.
The popup window displays how many instances of the application it has killed and you have to click the "OK" button before the script will kill the next application or close.
This is the script:
strComputer = "."
strProcessToKill = "cmd.exe"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = '" & strProcessToKill & "'")
count = 0
For Each objProcess in colProcess
objProcess.Terminate()
count = count + 1
Next
wscript.echo "Killed " & count & " instances of " & _
strProcessToKill & "on " & strComputer
strComputer = "."
strProcessToKill = "firefox.exe"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = '" & strProcessToKill & "'")
count = 0
For Each objProcess in colProcess
objProcess.Terminate()
count = count + 1
Next
wscript.echo "Killed " & count & " instances of " & _
strProcessToKill & "on " & strComputer
strComputer = "."
strProcessToKill = "yahoomessenger.exe"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = '" & strProcessToKill & "'")
count = 0
For Each objProcess in colProcess
objProcess.Terminate()
count = count + 1
Next
wscript.echo "Killed " & count & " instances of " & _
strProcessToKill & "on " & strComputer
Thanks.