what type of process? you can due a number of things. redirect, exit sub, end if etc.......
a bit more detailed explanation may help out
_________________________________________________________ $str = "sleep is good for you. sleep gives you the energy you need to function";
$Nstr = ereg_replace("sleep","coffee",$str); echo $Nstr;
Scripting the Operating System
You've started to use the new services available in Windows 2000 and your Web site is about to go live on your Web server farm. Great—but how are you going to administer the site? Previously, this hasn't been the easiest thing to accomplish with the Windows NT® operating system, but manageability was a major focus for Windows 2000. I've written in the past about the wonders of the ADSI-WMI combination, but I've given only examples of how to use theose technologies. For this article, I thought I'd try and provide a more in depth sample that you could actually use.
One of the nightmare scenarios for all administrators is when a server stops responding—and no matter how many times you press the stop button in the management console, the errant process refuses to shut down. Those of you familiar with Unix are probably thinking, "I'd just run PS, get the process ID, and then kill it." Unfortunately, Windows 2000 doesn't come with those utilities built in. It does provide all the right components to achieve the same result—and with a little script, we can recreate these features.
Writing PS in script is reasonably simple with Windows Management Instrumentation (WMI). You just have to query the Win32_process service. This returns a collection of all the processes that are running on the machine. The script to return the process name and ID looks like this:
VBScript
set objService = getobject("winmgmts:"
for each Process in objService.InstancesOf("Win32_process"
WScript.echo Process.Name & vbTab & Process.processid
Next
Once we get the process ID, we need to be able to kill the process. Writing kill in script is a little more complex than returning the processes—but only slightly, as it still uses the Win32_process object. I've attached a full blown kill.vbs and ps.vbs that you can use for more details.
However the kill.vbs and ps.vbs are not attached to the article (not that I can see anyway).
thats the way id would do it.
there is a kill.exe available which comes with the nt resource kit.
this kill.exe doesnt work in wxp though, there is another exe available but i cant remember the name
what exe are you trying to kill??
ive had a big set to with people here about use of the kill.exe as they were closing outlook and excel and word with it!! in cases where you have good doucmentation on the object model you are better off closing/killin the app via the object model. objWinword.Quit or something like that, and closing and saving all open documents before you do that.
but back to killing an exe i would go with the WMI
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2"
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = 'explorer.exe'"
For Each objProcess in colProcessList
objProcess.Terminate()
Next
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.