I would like to get instances from netstat -anob like
Proto Local Address Foreign Address State PID
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 976
RpcSs [svchost.exe]
TCP 0.0.0.0:2030 0.0.0.0:0 LISTENING 2256
[omtsreco.exe]
and keep it in XML format, so the fragment of code like this is not fit for me
set sh = CreateObject("Wscript.Shell")
call GetConnections()
Function GetConnections()
i = 0
set shExec = sh.Exec("netstat -anob")
Do While Not shExec.StdOut.AtEndOfStream
Wscript.Echo shExec.StdOut.ReadLine()
Loop
End Function
I found that I can get PID and executable from Win32_Process but other instances I have no idea how to get it. I wonder if it possible to use a WMI to fit a command above and I would be appreciated if anyone can guide how to do it.
PS. I have to create it in .vbs extension so WMI would fit for solution if possible.
Regards,
Phamornh