如何获取LAN上的活动IP地址,MAC地址和NetBIOS名称列表?

时间:2021-10-26 22:38:18

How do I get a list of the active IP-addresses, MAC-addresses and NetBIOS names on the LAN?

如何获取LAN上的活动IP地址,MAC地址和NetBIOS名称列表?

I'd like to get NetBIOS name, IP and MAC addresses for every host on the LAN, preferably not having to walk to every single PC and take note of the stuff myself.

我想为局域网中的每个主机获取NetBIOS名称,IP和MAC地址,最好不要走到每台PC并自己记录这些内容。

How to do that with Windows Script Host/PowerShell/whatever?

如何使用Windows Script Host / PowerShell /做什么?

5 个解决方案

#1


9  

As Daren Thomas said, use nmap.

正如达伦托马斯所说,使用nmap。

 nmap -sP 192.168.1.1/24

to scan the network 192.168.1.*

扫描网络192.168.1。*

 nmap -O 192.168.1.1/24

to get the operating system of the user. For more information, read the manpage

获得用户的操作系统。有关更多信息,请阅读联机帮助页

 man nmap

regards

#2


6  

arp -a

That gets everything the current machine knows about on the network.

这可以获得当前机器在网络上所知道的一切。

(I'm putting this up there as a second option, since nmap isn't universally installed).

(我把它放在那里作为第二个选项,因为nmap不是普遍安装的)。

#3


2  

If you're using DHCP then the server will give you a list of all that information.

如果您使用的是DHCP,那么服务器将为您提供所有信息的列表。

This website has a good tutorial on using powershell to get networking information http://www.powershellpro.com/powershell-tutorial-introduction/powershell-scripting-with-wmi/

这个网站有一个很好的教程,使用PowerShell来获取网络信息http://www.powershellpro.com/powershell-tutorial-introduction/powershell-scripting-with-wmi/

If you neet to get quick list of computer names you can use "net view". Also have a look at nbmac although I'm unsure of it's working status under XP. Another option could be to use nbtstat -a (once you've used net view to list workstations)

如果您需要快速获取计算机名称列表,可以使用“网络视图”。还看看nbmac虽然我不确定它在XP下的工作状态。另一种选择可能是使用nbtstat -a(一旦你使用网络视图列出工作​​站)

#4


1  

In PowerShell you can do something like:

在PowerShell中,您可以执行以下操作:

$computers = "server1","server2","server3"

$ computers =“server1”,“server2”,“server3”

Get-WmiObject Win32_NetworkAdapterConfiguration -computer $computers -filter "IPEnabled ='true'" | select __Server,IPAddress,MACAddress

Get-WmiObject Win32_NetworkAdapterConfiguration -computer $ computers -filter“IPEnabled ='true'”|选择__Server,IPAddress,MACAddress

#5


0  

In PowerShell:

function Explore-Net($subnet, [int[]]$range){
    $range | % { test-connection "$subnet.$_" -count 1 -erroraction silentlycontinue} | select -Property address | % {[net.dns]::gethostbyaddress($_.address)}
}

Example:

Explore-Net 192.168.2 @(3..10)

#1


9  

As Daren Thomas said, use nmap.

正如达伦托马斯所说,使用nmap。

 nmap -sP 192.168.1.1/24

to scan the network 192.168.1.*

扫描网络192.168.1。*

 nmap -O 192.168.1.1/24

to get the operating system of the user. For more information, read the manpage

获得用户的操作系统。有关更多信息,请阅读联机帮助页

 man nmap

regards

#2


6  

arp -a

That gets everything the current machine knows about on the network.

这可以获得当前机器在网络上所知道的一切。

(I'm putting this up there as a second option, since nmap isn't universally installed).

(我把它放在那里作为第二个选项,因为nmap不是普遍安装的)。

#3


2  

If you're using DHCP then the server will give you a list of all that information.

如果您使用的是DHCP,那么服务器将为您提供所有信息的列表。

This website has a good tutorial on using powershell to get networking information http://www.powershellpro.com/powershell-tutorial-introduction/powershell-scripting-with-wmi/

这个网站有一个很好的教程,使用PowerShell来获取网络信息http://www.powershellpro.com/powershell-tutorial-introduction/powershell-scripting-with-wmi/

If you neet to get quick list of computer names you can use "net view". Also have a look at nbmac although I'm unsure of it's working status under XP. Another option could be to use nbtstat -a (once you've used net view to list workstations)

如果您需要快速获取计算机名称列表,可以使用“网络视图”。还看看nbmac虽然我不确定它在XP下的工作状态。另一种选择可能是使用nbtstat -a(一旦你使用网络视图列出工作​​站)

#4


1  

In PowerShell you can do something like:

在PowerShell中,您可以执行以下操作:

$computers = "server1","server2","server3"

$ computers =“server1”,“server2”,“server3”

Get-WmiObject Win32_NetworkAdapterConfiguration -computer $computers -filter "IPEnabled ='true'" | select __Server,IPAddress,MACAddress

Get-WmiObject Win32_NetworkAdapterConfiguration -computer $ computers -filter“IPEnabled ='true'”|选择__Server,IPAddress,MACAddress

#5


0  

In PowerShell:

function Explore-Net($subnet, [int[]]$range){
    $range | % { test-connection "$subnet.$_" -count 1 -erroraction silentlycontinue} | select -Property address | % {[net.dns]::gethostbyaddress($_.address)}
}

Example:

Explore-Net 192.168.2 @(3..10)