使用PowerShell获取所有本地IP地址并保存到txt文件中。希望筛选MAC地址。

huangapple go评论74阅读模式
英文:

get all local IP address Using powershell in txt file. Want to filter MAC address

问题

I want to save all active IP address under 192.168.1 subnet mask and there MAC address starts with "00:1f".

This question is already answered but how can I filter using MAC address and save only IP not other information.

[Question] https://stackoverflow.com/questions/41785413/use-powershell-to-get-device-names-and-their-ipaddress-on-a-home-network

英文:

I want to save all active IP address under 192.168.1 subnet mask and there MAC address starts with "00:1f".

This question is already answered but how can I filter using MAC address and save only IP not other information.

[Question] https://stackoverflow.com/questions/41785413/use-powershell-to-get-device-names-and-their-ipaddress-on-a-home-network

答案1

得分: 1

使用Get-NetNeighbor 并使用Where-Object 过滤输出:

Get-NetNeighbor -IPAddress 192.168.1.* | Where-Object LinkLayerAddress -like '00-1F-*' | ForEach-Object IPAddress
英文:

Use Get-NetNeighbor and filter the output with Where-Object:

Get-NetNeighbor -IPAddress 192.168.1.* |Where-Object LinkLayerAddress -like '00-1F-*' |ForEach-Object IPAddress

huangapple
  • 本文由 发表于 2023年3月8日 19:09:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/75672231.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定