Ok, so I'm kinda new to WMI.
Can you show some examples? I don't know where to begin with this WMI...
Thanks!
Main Topics
Browse All TopicsHi All.
I'm making a small administration application and given a server name / IP address, I would like to tell whether the remote server has established a connection on a given port.
Is there any programmatic way of doing this?
I don't mind running a remote netstat command with some params and pars the answer back on the administration server.
I'm using C# on a Windows Server 2003 with latest of everything...
Here's an example of what I'm looking for:
> myapp.exe remoteServerNmae 2048 [ENTER]
would return a list of all established TCP connections on "remoteServerName" where the listening port on that server is 2048.
Hope this is clear enough. I would be happy to answer any questions you might have regarding this subject.
Thanks!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
start with http://www.microsoft.com/t
But I cannot find how to access netstat data via WMI... Not sure it's possible, sorry but I'm still searching.
If it is really impossible - you have to run own process on the remote machine, read open ports and send the data to your app.
If you would not mind using external tools, a combination of psexec and tcpvcon (both free, from www.sysinternals.com) would do:
psexec \\remoteserver -u login -p pwd \\server\uts\tcpvcon -cn | findstr /R "\<2048\>"
The "\<2048\>" will search for a complete word, so you get no line for 12048 or 20481.
Business Accounts
Answer for Membership
by: gtworekPosted on 2009-08-23 at 06:53:38ID: 25162639
There's no WinAPI for querying this. You have to run own process on the remote machine or ask via WMI.