查询域中在线的计算机

发布于 2024-07-27 04:10:03 字数 386 浏览 5 评论 0原文

在我工作的地方,我们使用一款名为 Dameware 的软件来远程管理我们域中的计算机。 通过 Dameware,我们可以获得所有在线且当前连接到域的计算机的列表。

我们正在推出新的桌面管理软件,但该软件不提供此功能。 当我们想要连接到计算机时,我们需要知道计算机的名称。

我知道如何获取属于该域的计算机列表,但也返回可能在线或不在线的计算机。 如何返回当前连接到域的计算机列表(即它们具有活动的网络连接)? 我考虑过返回属于该域的计算机列表,然后对每台计算机执行 ping 操作,但我认为这会很慢并且完全浪费资源。

我更喜欢 .NET 解决方案,但 VB 脚本也可以工作。 我最终可能会为此构建一个 GUI,并将其分发给我们 IT 团队的成员。

Where I work we use a piece of software called Dameware to remotely manage computers on our domain. Through Dameware we are able to get a list of all of the computers that are online and currently connected to the domain.

We are in the process of rolling out new desktop management software that does not provide this feature to us. We need to know the name of a computer when we want to connect to it.

I know how to get a list of the computers that belong to the domain but that also returns computers that may or may not be online. How do I return a list of computers that are currently connected (ie. they have an active network connection) to the domain? I thought about returning a list of computers that belong to the domain and then pinging each one but I think that would be slow and a complete waste of resources.

I would prefer a .NET solution but VB script will work as well. I may end up building a GUI for this that I would distribute to members of our IT team.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

凶凌 2024-08-03 04:10:03

嗯,Ping确实可以工作。

我正在研究 scapy 库,它是一个用于创建 TCP/IP 数据包的 python 库。 我曾经 ping 过 192.168.1.0/24 这样的子网。 我尝试了多种 ping - ARP、ICMP、TCP.UDP。 结果令人震惊——TCP

  • 和 UDP ping 需要终生才能完成
    返回所有答案
  • ICMP 也花费更少的时间,但仍然
    我必须等待 40 秒或更长的
  • ARP ping 是最好的。 花了不
    超过2-3秒返回
    回答。 你可以试试这个然后告诉我
    您的体验如何

您应该使用 . NET 这样做。

您甚至应该检查Stack Overflow 上的这个问题


.NET 的 ARP 库

到目前为止,我不知道 .NET 是否提供了 ARP 的抽象,但它可以通过 iphlpapi.dll 使用。

这个 DLL 有一个名为 SendARP 的函数,它有一个签名

int SendARP( int DestIP, int SrcIP, byte[] pMacAddr, ref uint PhyAddrLen );

您应该检查 此页面了解更多示例,并阅读有关 iphlpapi.dll

Well Ping can actually work.

I am working on scapy library which is a python library to create TCP/IP packets. I used to ping a subnet like 192.168.1.0/24. I tried many kinds of pings - ARP, ICMP, TCP.UDP. The results were shocking --

  • TCP and UDP ping take lifelong to
    return all the answers
  • ICMP also takes less time, but still
    I had to wait for 40s or more
  • ARP pings were the best. It took not
    more than 2-3 secs to return back the
    answer. You can try this and tell me
    what are your experiences

You should use the Ping class of .NET for doing so.

You should even check this question on Stack Overflow


ARP Library for .NET

As of now I don't have any idea if .NET gives an abstraction of ARP, but it can be used via iphlpapi.dll

This DLL has a function named SendARP having a signature

int SendARP( int DestIP, int SrcIP, byte[] pMacAddr, ref uint PhyAddrLen );

You should check this page for more example and also read about iphlpapi.dll

萌︼了一个春 2024-08-03 04:10:03

您可以在每台计算机上安装一个向中央数据库发送心跳的监控应用程序吗?
然后,您可以通过在每台计算机上安装一个小应用程序来从数据库查询、跟踪更多统计数据等。

通过这种方式,您可以将监控工具保持状态的成本分配到每台机器,获得保留历史记录的能力(哪些机器在什么时间停机等),并简化监控工具以仅在数据库上运行快速查询而不是在每台机器上执行 ping

另外,我遇​​到了一些问题,某些机器根据其防火墙设置不响应 ping(谢谢 Windows XP 并打开了防火墙)。

最后,这样做的好处是,您还可以替换 UI 以使用您想要的任何内容(C#、网页等)。

Can you install on each computer a monitor app that sends a heartbeat to a central DB?
Then, you could query from the DB, keep track of more stats, etc by having a little app on each computer.

This way, you distribute the cost of keeping status from your monitoring tool to each machine, get the ability to keep history (which machines were down at what time, etc), and simplify your monitoring tool to just run a quick query on the DB instead of doing pings on each machine

Also, I've had problems with some machines not responding to pings depending on their firewall settings (thank you Windows XP with Firewall turned on).

Finally, the good thing about this is that you can also replace your UI to use whatever you wanted (C#, web page, etc...).

迟到的我 2024-08-03 04:10:03

如何使用 NetServerEnum 查找所有计算机?
无论如何,我建议您不要费心查找哪台机器在线,因为当用户/应用程序尝试在该机器上执行操作时,情况可能会发生变化。

How do you find all the computers using NetServerEnum?
Anyway I suggest that you don't bother with finding which machine is online, since that could change by the time the user/application will try to act on that machine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文