Oliver said:
Thanks for this script,
but it is not exactly what I was looking for. The XLVIEW-Process is
started by a user on the terminalserver, and if the user doesn't shut
it down by himself I like to kill the process if it runs longer then
15Min.
Maybe this is also chalenging for you. Thanks a lot.
Hi
Try this one:
sComputer = "." ' use "." for local computer
Set oWmi = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& sComputer & "\root\cimv2")
' script will run forever
Do While True
Set colProcessList = oWmi.ExecQuery _
("Select * from Win32_Process Where Name = 'XlView.exe'")
If colProcessList.Count > 0 Then
' sleep for 15 minutes (in milliseconds)
WScript.Sleep 15 * 60 * 1000
' check if XlView.exe is still in memory
Set colProcessList = oWmi.ExecQuery _
("Select * from Win32_Process Where Name = 'XlView.exe'")
' if XlView is in memory, it will be terminated
For Each oProcess in colProcessList
oProcess.Terminate()
Next
End If
' sleep one minute before testing again
WScript.Sleep 60 * 1000
Loop