【问题标题】:Scanning AD for Windows Server with proxy enabled在启用代理的情况下为 Windows Server 扫描 AD
【发布时间】:2018-09-06 07:20:31
【问题描述】:

我想扫描 AD 计算机并获取安装了 Windows Server 并设置了代理地址的信息。

如何组合这些命令:

Get-ADComputer -Filter 'OperatingSystem -like "Windows Server*"' -Properties IPv4Address,OperatingSystem,proxyaddresses | FT Name,DNSHostName,IPv4Address,OperatingSystem,proxyaddresses -A

Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' | Select-Object *Proxy*

要获得这种列表:

Name------DNSHostName----------IPv4Address------OperatingSystem---------proxyaddresses  
Server --- Server.domain.com-----192.168.1.1-------Windows Server 2008 ----192.168.1.100   
Server1--- Server1.domain.com-----192.168.1.2-------Windows Server 2008 ----192.168.1.100   
Server2 --- Server2.domain.com-----192.168.1.3-------Windows Server 2008 ----none

【问题讨论】:

  • 您是否正在寻找设置了代理地址或 ProxyEnable = $true(注册表设置)的服务器?
  • 这两个信息。

标签: powershell proxy registry windows-server


【解决方案1】:

这将是一个可能的解决方案:

$outputList = @()
Get-ADComputer -Filter {OperatingSystem -like "Windows Server*"} -Properties IPv4Address,OperatingSystem,proxyaddresses | Select-Object Name,DNSHostName,IPv4Address,OperatingSystem,proxyaddresses | foreach {

    $hashTable = @{}
    $hashTable.add("Name", $_.Name)
    $hashTable.add("DNSHostName", $_.DNSHostName)
    $hashTable.add("IPv4Address", $_.IPv4Address)
    $hashTable.add("OperatingSystem", $_.OperatingSystem)
    $hashTable.add("proxyaddresses", $($_.proxyaddresses -join ", "))

    $itemProperty = Invoke-command -ComputerName $_.DNSHostName -ScriptBlock {
        Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" | Select-Object *proxy*
    }

    $hashTable.add("ProxyEnable", $itemProperty.ProxyEnable)
    $outputList += New-Object PSObject -Property $hashTable
}

$outputList | ft

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-07-07
    • 1970-01-01
    • 1970-01-01
    • 2019-09-02
    • 1970-01-01
    • 1970-01-01
    • 2021-06-16
    • 1970-01-01
    相关资源
    最近更新 更多