从LAN获取设备名称 [英] get device name from LAN

查看:172
本文介绍了从LAN获取设备名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获得通过网络接口卡(LAN)连接的设备名称,如下图所示。



您可以在红色中看到设备名称边框



图片

I want to get the device name that connected through the network interface card (LAN) like the image below.

You can see the device name in the red border

Image

推荐答案

您可以从WMI获取此信息。



对于XP,Vista,Seven: Win32_NetworkAdapter类 [ ^ ]

自8,8.1,Server 2012:MSFT_NetAdapter class [ ^ ]

对于这两个类,您所属的属性感兴趣的是'状态'。



在这里你可以有一个关于如何使用C#中的WMI类的线索:

示例C#代码,用于使用最新的WMI类来管理Windows存储 [ ^ ]

您只需更改范围并调整查询。
You can get this information from WMI.

For XP, Vista, Seven: Win32_NetworkAdapter class[^]
Since 8, 8.1, Server 2012: MSFT_NetAdapter class[^]
For both of these classes, the property you are interested in is 'Status'.

Here you can have a clue about how to use WMI classes from C#:
Sample C# code for using the latest WMI classes to manage Windows Storage[^]
You just have to change the scope and adapt the query.


这篇关于从LAN获取设备名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆