【问题标题】:Associate an IP address list with the existing subnet and site将 IP 地址列表与现有子网和站点相关联
【发布时间】:2018-10-19 10:30:37
【问题描述】:

我有一个 IP 地址列表,我需要为该列表的每个 IP 地址关联站点和子网。 我有5203 IP地址,一一验证太多了;也许有人可以帮助我? 谢谢。

【问题讨论】:

    标签: windows powershell active-directory subnet sites


    【解决方案1】:

    您没有像@boxdog 所说的那样提供太多信息。 我猜您正在使用 DHCP,并且您想查询租用的范围和 IP。

    $scopes = Get-DhcpServerv4Scope -ComputerName "DHCP-Server"
    foreach($scope in $scopes)
    {
        write-host -ForegroundColor Cyan "The current scope name is: " -NoNewline; Write-Host -ForegroundColor Green $scope.name 
        $lease = Get-DhcpServerv4Lease -ScopeId $scope.ScopeId -ComputerName "DHCP-Server"
        $lease
    
    }
    

    如果没有,请提供有关您想要做什么的更多信息。您已经编写的脚本也很有帮助。

    【讨论】:

    • 好的,我了解 SteTheo。所以,我们在一个 txt 文件中有一个 IP 地址列表。我被要求用我们森林中的子网和站点 Active Directory 对应的 IP 地址列表创建文件 csv。
    • 你的意思是这样的:$IPAdd = Get-Content "path of the txt file, e.g. c:\system\IPaddress.txt" ForEach ($IP in $IPAdd){ Get-DhcpServerv4Lease -IPAddress $IP -ComputerName "DHCPServer Name" | Format-Table -AutoSize }
    • 谢谢 StefTheo,但我需要现场检查并服务 Active Directory,因为在此基础架构中,DHCP 由设备网络管理。
    • 我不明白你想做什么。以及您将从 AD 站点和服务获得哪些信息。如果在 DNS 中注册,也许 ping -a IP 会返回一些 DNS 名称。如果您可以分享更多信息,也许我可以帮助您。
    猜你喜欢
    • 2017-08-21
    • 2010-12-28
    • 2012-07-01
    • 2010-12-22
    • 1970-01-01
    • 1970-01-01
    • 2018-12-19
    • 2016-04-11
    • 2013-11-12
    相关资源
    最近更新 更多