Acá les comparto un script que reinicia un programa al tener cierta cantidad de procesos abiertos, el script es simple espero que les ayude, tambien puede sermodificado para saber la cantidad de memoria y agregar el reconocimiento de S.O
Option Explicit 'variables Dim ObjWMI, ColSettings, ObjProcessor Dim StrComputer, ObjNetwork Dim SO, objShell, i 'variables para lectura de archivo Dim objFSO, proces, txt, , file, oShell Set ObjNetwork = WScript.CreateObject("WScript.Network") StrComputer = Trim(ObjNetwork.ComputerName) Set ObjWMI = GetObject("WINMGMTS:" & "{ImpersonationLevel=Impersonate,AuthenticationLevel=Pkt}!\\" & StrComputer & "\Root\CIMV2") Set ColSettings = ObjWMI.ExecQuery ("SELECT * FROM Win32_Processor") For Each ObjProcessor In ColSettings Set objShell = CreateObject("Wscript.Shell") i = objShell.RUN ("cmd /c tasklist | find ""iexplore.exe"" /c >C:\microtec\moni_ie.txt") if i = 0 then WScript.Sleep 1000 set objFSO = CreateObject("Scripting.FileSystemObject") 'abrir archivo txt de procesos set txt = objFSO.OpenTextFile ("C:\Microtec\moni_ie.txt") 'leer txt y cerrar txt proces = txt.Readline txt.close WScript.Sleep 1000 if proces > 4 then Set objShell = CreateObject("Wscript.Shell") objShell.RUN ("cmd /c taskkill /IM iexplore.exe /f ") WScript.Sleep 1000 objShell.RUN ("iexplore.exe") end if end if 'WScript.Echo proces Next
0 Comentarios