'##################################################### '######### Created By Shawn Brito (2014) '######### You have the license to Modify&Share FREELY '##################################################### totWorking=0 totPageFile=0 totThreads=0 totWorking2=0 totPageFile2=0 totThreads2=0 exitCode=0 set Param = wScript.Arguments if Param.Count < 1 Then WScript.echo "4: No parameters set" WScript.Quit(4) ElseIf Param.Count > 5 Then WScript.echo "4: Too many parameters" WScript.Quit(4) Else Set objWMI = GetObject("winmgmts:\\.\root\cimv2") Set colObjects = objWMI.ExecQuery("Select * From Win32_Process where name='"&Param(0)&"'") 'WScript.echo "Processing Exe" For Each Item in colObjects ' WScript.Echo Item.Name &"/"&Item.ProcessID&"-"&Item.WorkingSetSize&"-"&Item.ThreadCount totWorking = totWorking + Item.WorkingSetSize totPageFile = totPageFile + Item.PageFileUsage totThreads = totThreads + Item.ThreadCount Next Set colObject2 = objWMI.ExecQuery("Select * From Win32_Process where name='"&Param(1)&"'") For Each Item2 in colObject2 ' WScript.Echo Item2.Name &"/"&Item2.ProcessID&"-"&Item2.WorkingSetSize&"-"&Item2.ThreadCount totWorking2 = totWorking2 + Item2.WorkingSetSize totPageFile2 = totPageFile2 + Item2.PageFileUsage totThreads2 = totThreads2 + Item2.ThreadCount Next End if WScript.Echo "WorkingSet["&Param(0)&"]="&totWorking\(1024*1024)&"mb ThreadCount=["&totThreads&"] WorkingSet["&Param(1)&"]="&totWorking2\(1024*1024)&"mb] ThreadCount=["&totThreads2&"] | "&Param(0)&"W="&totWorking&";0;0;0; "&Param(0)&"P="&totPageFile&";0;0;0; ThreadCount"&Param(0)&"="&totThreads&";0;0;0; "&Param(1)&"W="&totWorking2&";0;0;0; "&Param(1)&"P="&totPageFile2&";0;0;0; ThreadCount"&Param(1)&"="&totThreads2&";0;0;0;" totWorking=totWorking\(1024*1024) totWorking2=totWorking2\(1024*1024) if (totWorking > Param(2)) Or (totWorking2 > Param(3)) Then exitCode=2 Else exitCode=0 End if WScript.Quit exitCode