Powershell-过滤IP对应MAC或主机名

需求:web

安全同事新需求,想经过IP地址及时溯源出MAC或主机名信息;
shell

环境:
安全

Windows Server 2016 + DHCP服务器

分析:
app

记得以前写过一篇"Powershell-过滤MAC地址对应IP地址信息"文章;ide

经过相同原理可实现MAC与主机名信息过滤;spa

步骤:code

1.相关DHCP服务器命令选择:orm

Get-DhcpServerv4Lease :ip

从动态主机配置协议(DHCP)服务器服务获取一个或多个租约记录。

GET-DhcpServerv4Scope :

返回指定范围的IPv4范围配置。若是未指定ScopeId参数,则返回动态主机配置协议(DHCP)服务器服务上配置的全部范围。

  • Get-DhcpServerv4Lease[-ComputerName <String>]-IPAddress <IPAddress[]>[-CimSession <CimSession[]>][-ThrottleLimit <Int32>][-AsJob][<CommonParameters>]Get-DhcpServerv4Lease[-ComputerName <String>][-ScopeId] <IPAddress>[-ClientId] <String[]>[-CimSession <CimSession[]>][-ThrottleLimit <Int32>][-AsJob][<CommonParameters>]Get-DhcpServerv4Lease[-ComputerName <String>][-BadLeases][[-ScopeId] <IPAddress>][-CimSession <CimSession[]>][-ThrottleLimit <Int32>][-AsJob][<CommonParameters>]
    2.查询全部做用域下的租约信息,并过滤IP地址对应MAC及主机名信息:
  • Get-DhcpServerv4Scope |Get-DhcpServerv4Lease |where {$_.IPAddress -like "10.18.133.27"}
    640?wx_fmt=png&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1



640?wx_fmt=png&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1

相关文章
相关标签/搜索