简体   繁体   English

从.Net属性获取VBScript中的活动网络连接

[英]Get Active Network Connections in VBScript from .Net Properties

There is a .NET method used for retrieving TCP and UDP connection information as listed below: 有一种.NET方法可用于检索TCP和UDP连接信息,如下所示:

[Net.NetworkInformation.IPGlobalProperties]::GetIPGlobalProperties().GetActiveTcpConnections()
[Net.NetworkInformation.IPGlobalProperties]::GetIPGlobalProperties().GetActiveUdpConnections()

I was curious if there is a way to do the same via VBScript? 我很好奇是否可以通过VBScript进行相同的操作? I would like to have the output of all of the connections, similar to a netstat -an output, returned in a VBscript that I am using for network documentation. 我想在我用于网络文档的VBscript中返回所有连接的输出,类似于netstat -an输出。 If this is possible via a WMI query, I would be interested in that as well. 如果可以通过WMI查询来实现,那么我也将对此感兴趣。

Here are some links for reference to the .Net methods listed: 这里是一些链接,可参考列出的.Net方法:

Your best bet would be to use PowerShell, which has direct access to .NET. 最好的选择是使用可以直接访问.NET的PowerShell。

The other option would be to run Netstat.exe from WScript.Shell and parse the results, as per Netstat with WMI and VBScript . 另一个选择是从WScript.Shell运行Netstat.exe并解析结果,就像使用WMI和VBScript的Netstat一样

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM