![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Scripting neophyte - why does this simple script not work? Hi all I know nothing at all about scripting, I've just copied this from a website. All I want to do is to kill a process which is running on several XP PCs - let's call it "rogueprocess.exe". If I look at Task Manager on the Processes tab "rogueprocess.exe" is running. And I want to kill it stone dead. Here's the script : '**************************************************************************** Option Explicit Dim objWMIService, objProcess, colProcess Dim strComputer, strProcessKill strComputer = "." strProcessKill = "'rogueprocess.exe'" 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 '************************************************************************** If I run this script, it doesn't kill the process. What is wrong with the script? Thanks for any assistance. Stephen |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Scripting neophyte - why does this simple script not work? "Stephen Mulholland" <mulhollands@xxxxxx> wrote in message news:4736d787-23ea-4ba4-834f-ef3b68eb6aac@xxxxxx Quote: > > Hi all > > I know nothing at all about scripting, I've just copied this from a > website. > > All I want to do is to kill a process which is running on several XP > PCs - let's call it "rogueprocess.exe". If I look at Task Manager on > the Processes tab "rogueprocess.exe" is running. And I want to kill it > stone dead. > > Here's the script : > > > '**************************************************************************** > Option Explicit > Dim objWMIService, objProcess, colProcess > Dim strComputer, strProcessKill > strComputer = "." > strProcessKill = "'rogueprocess.exe'" > > 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 > '************************************************************************** > > > If I run this script, it doesn't kill the process. What is wrong with > the script? > > Thanks for any assistance. > > Stephen not use the traditional methods of killing the process? a) Kill it from the Task Manager. b) Kill it with this command: taskkill /f /im "RogueProcess.exe" Note that some processes are not "killable". To test your script, use a process that you know can be killed, e.g. "notepad.exe". |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Scripting neophyte - why does this simple script not work? On Jan 12, 4:16*pm, "Pegasus \(MVP\)" <I....@xxxxxx> wrote: Quote: > "Stephen Mulholland" <mulholla...@xxxxxx> wrote in message > > news:4736d787-23ea-4ba4-834f-ef3b68eb6aac@xxxxxx > > > > > > > Quote: > > Hi all Quote: > > I know nothing at all about scripting, I've just copied this from a > > website. Quote: > > All I want to do is to kill a process which is running on several XP > > PCs - let's call it "rogueprocess.exe". *If I look at Task Manager on > > the Processes tab "rogueprocess.exe" is running. And I want to kill it > > stone dead. Quote: > > Here's the script : Quote: > > '***************************************************************************** > > Option Explicit > > Dim objWMIService, objProcess, colProcess > > Dim strComputer, strProcessKill > > strComputer = "." > > strProcessKill = "'rogueprocess.exe'" Quote: > > Set objWMIService = GetObject("winmgmts:" _ > > & "{impersonationLevel=impersonate}!\\" _ > > & strComputer & "\root\cimv2") Quote: > > Set colProcess = objWMIService.ExecQuery _ > > ("Select * from Win32_Process Where Name = " & strProcessKill ) > > For Each objProcess in colProcess > > objProcess.Terminate() > > Next > > '************************************************************************** Quote: > > If I run this script, it doesn't kill the process. *What is wrong with > > the script? Quote: > > Thanks for any assistance. Quote: > > Stephen > Instead of running a script that is outside your field of experience, why > not use the traditional methods of killing the process? > a) Kill it from the Task Manager. > b) Kill it with this command: taskkill /f /im "RogueProcess.exe" However, when I say the rogue process is running on "several XP PCs", you might want to read "several XP PCs" as "over 1800 XP PCs". Oops. Long story, but basically I messed up, not to put too fine apoint on it. I rolled out a program using SMS 2003, messed up the program's command line and now the program can't finish. I need to kill the process invisibly, so the plan is to convert the vb script to an exe, roll it out with SMS, let it run and finish - rogue process killed, problem solved. Thanks Stephen Quote: > > Note that some processes are not "killable". To test your script, use a > process that you know can be killed, e.g. "notepad.exe".- Hide quoted text - > > - Show quoted text - |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Scripting neophyte - why does this simple script not work? Or save a step and just use pskill (also Sysinternals free utility) |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Simple script to change filenames | PowerShell | |||
| simple script to query canonical name | PowerShell | |||
| Simple login mapping script doesn't run properly | Network & Sharing | |||
| simple disk usage -> email script | PowerShell | |||
| Sidebar corruption, IE scripting does not work | Vista General | |||