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 a process

Status
Not open for further replies.

staann56

IS-IT--Management
Sep 28, 2004
24
US
I have the following VBscript that kills a process sucessfully on my local PC, but when I try to run this script on our server it doesn't kill the busobj.exe process. Why would this be?

Thanks,
Stan


ServerName = "."

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!//" & ServerName)
Set colProcessList = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = 'BUSOBJ.EXE'")

For Each Proc in colProcessList
If Proc.CreationDate <> "" Then
PDate = Left(Proc.CreationDate,14)
Days = DateDiff("d",DateSerial(Left(PDate,4),Mid(PDate,5,2),Mid(PDate,7,2)),Date)
Hrs = Hour(Now) - Mid(PDate,9,2)
Min = Minute(Now) - Mid(PDate,11,2)
Sec = Second(Now) - Mid(Pdate,13,2)
If Min > 5 Then
Proc.Terminate()
End If
End If
NEXT
 
Check taskmgr for the correct name of the process on the server. It could be that the process name is shortened on the server such as busobj.ex or something to that affect.

Hope this helps.

JP
 
The process is named the same.

Thanks,
Stan
 
>Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!//" & ServerName)
[tt]Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate[blue],(debug)[/blue]}!//" & ServerName)[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top