【问题标题】:Using PowerShell to get all active-domain computers使用 PowerShell 获取所有活动域计算机
【发布时间】:2014-03-20 11:31:44
【问题描述】:

我正在使用此脚本(如下)来获取域中的所有计算机;但是当我知道显然还有更多时,它似乎停在了 1000 点上。我将如何获得完整的清单?

$strCategory = "computer"

$objDomain = New-Object System.DirectoryServices.DirectoryEntry

$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.SearchRoot = $objDomain
$objSearcher.Filter = ("(objectCategory=$strCategory)")

$colProplist = "name"
foreach ($i in $colPropList){$objSearcher.PropertiesToLoad.Add($i)}

$colResults = $objSearcher.FindAll()

foreach ($objResult in $colResults)
{$objComputer = $objResult.Properties; $objComputer.name >> allcomps.csv}

【问题讨论】:

    标签: powershell active-directory


    【解决方案1】:

    尝试添加

    $objSearcher.PageSize = 2000
    

    http://technet.microsoft.com/en-us/library/ff730959.aspx

    【讨论】:

      猜你喜欢
      • 2017-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-13
      • 2011-08-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多