This is a simple script to check how much memory is using for a given process name

 

$oProcList=get-wmiobject win32_process | where{$_.name -eq "cgi.exe"}

$total=$NULL

foreach($item in $oProcList){

$mem=$item.workingsetsize

$total+=$mem

}

$rez=($total/1mb)

$rez