[英]Using PowerShell to get all active-domain computers
I'm using this script(below) to get all computers on the domain; 我正在使用下面的脚本来获取域中的所有计算机; but it seems like it stops at 1000 on the dot, when I know there is clearly more. 但是当我知道明显更多时,它似乎停在1000点上。 How would I go about getting the complete list? 我将如何获取完整列表?
$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}
try adding 尝试添加
$objSearcher.PageSize = 2000
http://technet.microsoft.com/en-us/library/ff730959.aspx http://technet.microsoft.com/en-us/library/ff730959.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.