Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

kill process by name not by pid 2

Status
Not open for further replies.

y3by

Programmer
Jan 15, 2002
92
PT
hi ppl,

i need to kill an application in all pc's on my network.

to do that machine by machine is a very hard work...

i need to do something like this

> kill applicationX in machineY

if i have a command that does that, i can make a script to kill in all machines...

can you help me?!??!

thks
 
pstools - is the tools you can use for free and can help you to complete the task.



Victor K
psas@canada.com
MCSE+I;MCSA;MCSE(w2k);CNE(5.1);CNE(6);CIWSP;CIWSA;Net+;CCNA
 
Use the following VBScript code straight from MS:

strComputer = "MachineY"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'Notepad.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next

You can modify this code to accept arguments and run it from the commandline like so:

cscript c:\path_to_scripts\termprocess.vbs /A:Notepad.exe /M:MachineY

Or you may use ADSI and enumerate through a group of computers and kill processes at each machine. For more scripting help go to:




Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top