header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

Getting remote network connections with WMI
Last Post 22 Sep 2008 01:44 AM by halr9000. 4 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
SynJunkieUser is Offline
New Member
New Member
Posts:97
Avatar

--
21 Sep 2008 01:43 AM  

Hi

Does anyone know if there is a WMI class I can query to list network connections (like netstat) on a remote host? I have trawled through them with WMIExporer but I am yet to find one.

Or is there a way with Powershell that I can call netstat on a remote host.

Any ideas would be greatly appeaciated.

Thanks

Lee

marco.shawUser is Online
Co-Community Director
Basic Member
Basic Member
Posts:195
Avatar

--
21 Sep 2008 01:58 AM  
What OS are you dealing with? WSMAN aka WinRM may help:
http://www.windowsnetworking.com/articles_tutorials/How-Windows-Server-2008-WinRM-WinRS.html

That's what PowerShell v2 remoting uses. You can actually use it with v1, but would need PowerShell on the remote end also.
Marco

*Microsoft MVP - Windows PowerShell: http://www.microsoft.com/mvp
*PowerGadgets MVP: http://www.powergadgets.com/mvp
*Blog: http://marcoshaw.blogspot.com
halr9000User is Offline
PowerShell MVP, Site Admin
Basic Member
Basic Member
Posts:335
Avatar

--
21 Sep 2008 02:06 AM  
I don't think you'll get very far with WMI. Check out this Get-Netstat script though, it "objectizes" the output from netstat.exe.

http://poshcode.org/558
Community Director, PowerShellCommunity.org
Co-host, PowerScripting Podcast
Author, TechProsaic
SynJunkieUser is Offline
New Member
New Member
Posts:97
Avatar

--
21 Sep 2008 09:09 PM  
The OS i'll be wanting to query will be Windows 2003 and I'm using powershell v1. Unfortunately I can't put PowerShell on the remote hosts just yet.

Hal - thanks for the link. I had already seen this both on your blog and in the script repository.
halr9000User is Offline
PowerShell MVP, Site Admin
Basic Member
Basic Member
Posts:335
Avatar

--
22 Sep 2008 01:44 AM  
Then psexec + netstat.exe will be one way to get it done. You could modify get-netstat to do all the work.
Community Director, PowerShellCommunity.org
Co-host, PowerScripting Podcast
Author, TechProsaic
You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer