Author: eva Article Source: Unknown Nature article: Reprinted Views: 16 Date: 2004-11-04 fport.vbs for XP / 2003 XP and have netstat 2003 under the -o option, it can be easily achieved fport. VBS script: CODZ: with new regexp .pattern = "(. PS S S S S [AZ] *) s * ([0-9] )" .Global = true set ms = .execute ("wscript.shell"). Exec ("NetStat -ano"). stdout.readall) End With for Each PS in getObject ("Winmgmts: /./ rootcimv2: win32_process"). Instances_ f = 0 for Each M IN ms if m.submatches (1) = ps.handle thein if f = 0 THEN F = 1: wscript.echo ">" & ps.handle & vbtab & ps.name & vbtab& ps.executablepath wscript.echo "& m.submatches (0) end if next NEXT gives an echo version to be used in remote shells. @echo with new regexp: .pattern = "(. p / s / s / s / s / s [az] *) / s * ([0-9] )" :. global = true> fp.vbs @echo set ms = .execute ("wscript.shell"). Exec ("NetStat -ano"). stdout.readall ">> fp.vbs @echo endo: for Each PS in getObject (" WinMgmts: / ./root/cimv2:Win32_process").instances_>>fp.vbs @echo f = 0: for Each M IN ms: if m.submatches (1) = ps.handle the_ >> fp.vbs @echo if f = 0 THEN F = 1: wscript.echo ">" ^ & ps.handle ^ & vbtab ^ & ps.name ^ & vbtab ^ & ps.executablepath: end if: _ >> fp.vbs @echo wscript.echo "^ & m.submatches (0): end if: next: Next >> fp.vbs @cscript // NOLOGO FP.VBS & DEL FP.VBS