totWorking=0 totPageFile=0 totThreads=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 End if WScript.Echo "WorkingSet["&Param(0)&"]="&totWorking\(1024*1024)&"mb ThreadCount=["&totThreads&"] PageFileUsed=["&totPageFile\(1024*1024)&"mb]| "&Param(0)&"W="&totWorking&";0;0;0; "&Param(0)&"P="&totPageFile&";0;0;0; ThreadCount="&totThreads&";0;0;0;" totWorking=totWorking\(1024*1024) if totWorking > Param(2) Then WScript.Quit 2 Else WScript.Quit 0 End if