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!

script to stop processes

Status
Not open for further replies.

bbolte

Programmer
Sep 30, 2002
113
US
I've had a script running on Win2k server for quite a while, it doesn't seem to function on Win2k3. I'm not sure if it is a permissions issue or differences on platforms. The script basically counts how many processess of a certain app are running and terminates all but 1 one of them. It's a long story of why we are doing this, needless to say, this is the only thing that I could come up with to appease the powers that be.

here is the part that is terminating the process
Code:
'// if SARTActive = false, close all but one corel
If SARTActive = False AND intCorelCount > 1 Then
	For Each Process In strObject.InstancesOf("Win32_Process")
	    If UCase(Process.Name) = UCase(strCorelProcess) AND intCorelCount > 1 Then
		intCorelCount = intCorelCount - 1
		Process.Terminate
	    End If
	Next
End If

any thoughts why this won't kill the strCorelProcess?
 
i should note that we have this script schedule to run as a task throughout the day.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top