始终得到使用PowerShell的通讯组列表1500件 [英] Always getting 1500 member of distribution list using PowerShell
问题描述
我想获得一定的分布列表中的所有成员(邮箱地址)。 目前,我只接受她的第一个1500的成员。我的脚本看起来像这样:
I would like to get all members (mail address) of a certain distribution list. Currently I just recieve the first 1500 members. My Script looks like that:
$group = [ADSI]"LDAP://CN=distListOne,OU=Groups,DC=XYZ,DC=XYZ"
$group.member.count ##Always 1500
foreach($member in $group.member)
{
$filter = "LDAP://"+$member
$user = [ADSI]$filter
$user.properties.mail | out-file "C:\distrUser.txt" -append
}
我知道,有超过1500个用户在通讯组列表。我需要无论如何扩展最大:收到groupmembers。
I know that there are more than 1500 users in the distribution list. I need anyhow to extend the maximum recieved groupmembers.
推荐答案
您需要更改code使用 DirectorySearcher从
的办法,和<一href="http://msdn.microsoft.com/en-us/library/system.directoryservices.directorysearcher.pagesize.aspx"相对=nofollow>检查出DirectorySearcher从的PageSize属性
You need to change your code to use a DirectorySearcher
approach, and check out the PageSize property of the DirectorySearcher
设置这个值的东西(而不是离开它0)开始的分页搜索的允许AD回1500多件。建议设置每页
来一个合理的值,像500或1000 - 如果你将它设置得太高(超过1500系统限制更高),它会被忽略并不能工作!
Setting that value to something (instead of leaving it 0) will start paged searching to allow AD to return more than 1500 members. It is recommended to set the PageSize
to a sensible value like 500 or 1000 - if you set it too high (higher than the system limit of 1500), it will be ignored and won't work!
关于如何解决这个问题,一些其他的博客文章:
See some other blog posts on how to tackle this problem:
List Members of Large Group
这篇关于始终得到使用PowerShell的通讯组列表1500件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!