Link to home
Start Free TrialLog in
Avatar of celtician
celticianFlag for American Samoa

asked on

Which process is reading this script

The next script is reading dllhost.exe amount of memory, however there are several dllhost.exe process in memory... so which one is taking the script? is it adding up all the memory all the process with the same name are using?

@echo off
setlocal
set LogFile=C:\Temp\dllhost.log
:loopPerf
set Usage=0
for /f "tokens=2 delims==" %%a in ('wmic.exe path Win32_PerfFormattedData_PerfProc_Process Where Name^='dllhost' get PercentProcessorTime /value ^| find.exe /i "PercentProcessorTime"') do set usage=%%a
if %usage% GEQ 80 (
	taskkill.exe /im dllhost.exe
	>>"%LogFile%" echo [%Date%][%Time%] Killed dllhost.
) else (
	echo abc
)
ping.exe -n 60 localhost >NUL
goto loopPerf

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of celtician

ASKER

I tried exactly as you told me and works wonderfully well!!!

Now i need to move this script to the other old server we have with the same problem its a windows nt machine... ill post another question for this.

thanks for the script, its absolutely amazin and can be used for any process!!