有没有办法以编程方式(在C#中)获取与我的计算机在同一域/子网中的所有其他工作站,并显示有关它们的一些信息(如果它们处于活动状态,安装了哪种操作系统, IP等)?
Is there any way to programatically (in c#) get all the other workstations that are in the same domain/subnetwork as my computer and display some information about them (if they are active, what kind of OS they have installed, their IP etc)?
推荐答案这是VB解决方案,但是我敢肯定,您将能够进行所需的更改以使这项工作有效!
This is a VB solution, but I'm pretty sure you'll be able to make the changes you need to make this work!
可能有更好的方法,但这是第一次切入.
There's probably a better way, but this was a first cut.
Imports System.Net.NetworkInformation Imports System.Directory Services Class NetworkInfo Function GetComputers() as list(Of String) dim List as new list(of String) Dim DomainEntry as new DirectoryEntry("WinNT://" + DomainInfo.GetDomain.Trim()) DomainEntry.Children.SchemaFilter.Add("computer") For Each Machine as DirectoryEntry in DomainEntry.Children List.Add(Machine.Name) Next return List End Function End ClassSystem.Net.NetworkInformation命名空间中提供了各种有用的工具,可让您捕获IP地址等内容.
There are all sorts of useful tools knocking about in the System.Net.NetworkInformation namespace to let you capture things like the IP address, etc.
更多推荐
在与我的计算机相同的网络中获取所有IP
发布评论