始终使用 PowerShell 获取 1500 名通讯组成员 [英] Always getting 1500 member of distribution list using PowerShell

查看:14
本文介绍了始终使用 PowerShell 获取 1500 名通讯组成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取某个分发列表的所有成员(邮件地址).目前我只收到了前 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 多个用户.无论如何,我需要扩展接收到的最大组成员.

I know that there are more than 1500 users in the distribution list. I need anyhow to extend the maximum recieved groupmembers.

推荐答案

您需要更改代码以使用 DirectorySearcher 方法和 检查 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 个成员.建议将 PageSize 设置为合理的值,例如 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:

列出大型组的成员

这篇关于始终使用 PowerShell 获取 1500 名通讯组成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆