簡體   English   中英

使用PowerShell獲取所有活動域計算機

[英]Using PowerShell to get all active-domain computers

我正在使用下面的腳本來獲取域中的所有計算機; 但是當我知道明顯更多時,它似乎停在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}

嘗試添加

$objSearcher.PageSize = 2000

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM