我有以下查询
$Groups = (Get-AdGroup -filter * | Where {
($_.name -like "*")
} | select ObjectGUID -expandproperty ObjectGUID)
$Table = @()
$Record = [ordered]@{
"Group _ObjectGUID" = ""
"Name" = ""
"SamAccountName" = ""
"Member_ObjectGUID" = ""
}
Foreach ($Group in $Groups)
{
$Arrayofmembers = Get-ADGroupMember -Recursive -identity $Group | select name,samaccountname,ObjectGUID
foreach ($Member in $Arrayofmembers)
{
$Record."Group _ObjectGUID" = $Group
$Record."Name" = $Member.name
$Record."SamAccountName" = $Member.SamAccountName
$Record."Member_ObjectGUID" = $Member.ObjectGUID
$objRecord = New-Object PSObject -property $Record
$Table += $objrecord
}
}
$Table | export-csv "C:\temp\AD_group_members.txt" -NoTypeInformation
然而,我无法执行此查询,因为它超过了5000个最大广告返回限制,具体返回以下错误消息:
我想不到任何方法来缩小它以避免此问题,因为更改所有域控制器(约300个)上的配置的解决方案不可行。Get-ADGroupMember:超出了此请求的大小限制。在第22行第20个字符处: + $Arrayofmembers = Get-ADGroupMember -Recursive -identity $Group | select name, ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo:NotSpecified:(70206804-1c23-4e47-8e9e-e8fb7c688826:ADGroup) [Get-ADGroupMember], ADException + FullyQualifiedErrorId:The size limit for this request was exceeded,Microsoft.ActiveDirectory.Management.Commands.GetADGroupMember
有人有什么建议吗?