组成员枚举限制... [英] group member enumeration limitation...

查看:131
本文介绍了组成员枚举限制...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试编写一个程序,该程序将在AD中找到所有组,并在与该组同名的文本文件中列出那里的用户.

我可以列出所有7000个ish组,但是如果它是一个很大的组,则只会列出1500个成员.我玩过PageSize和SizeLimit TNA.我可以列出Powershell中的所有成员-所以我知道有超过1500个!

下面的代码...

有什么想法吗?

(对不起,太厚了!)

非常感谢,
菲尔

Hi Guys,

I''m trying to write a program that will find all groups in AD and list there users in a text file of the same name as the group.

I can list all 7000 ish groups, but if it is a large group it will only list 1500 members. I have played around with PageSize and SizeLimit TNA. I can list all members in Powershell - so I know there are more than 1500!

code below...

any ideas?

(sorry for being thick!)

Many Thanks,
Phil

DirectorySearcher ds = new DirectorySearcher();
ds.Filter = "(objectClass=GROUP)";
ds.PageSize = Int32.MaxValue;
ds.SizeLimit = Int32.MaxValue;
ds.SearchScope = SearchScope.Subtree;
ds.PropertiesToLoad.Add("member");
ds.PropertiesToLoad.Add("sAMAccountName");
ds.Asynchronous = true;
SearchResultCollection sr = ds.FindAll();
           
foreach (SearchResult d in sr)
{
string fName = d.GetDirectoryEntry).Properties["sAMAccountName"].Value.ToString() + ".txt";
                    
StreamWriter sw = new StreamWriter(fName);
sw.AutoFlush = true;
                    
foreach (string i in d.GetDirectoryEntry().Properties["member"])
{
    sw.WriteLine(i);
}

推荐答案

您确定获得1500个结果吗?
据我所知,限制为1000.请在此处 [ ^ ].
Are you sure, you get 1500 results?
As far as I know the limitation is 1000. Have a look here[^].


尝试将页面大小设置为大约1000(因为这只是每次运行要返回的条目数量.服务器返回前1000个后,它将从停止的地方重新开始,以完成在SizeLimit中设置的条目数量.

我记得很久以前使用过它,我认为如果将PageSize设置得太高,它将被忽略并且分页将被关闭. (但还是很久以前了)
Try setting the page size to something around 1000 (as this is just the amount of entries to return on each run. Once the server has returned the first 1000 it will start again from where it left off to complete the amount of entries set in SizeLimit).

I remember using this a long time ago and I think that if you set the PageSize too high, it''s ignored and paging is switched off. (but again, it was a long time ago)




是的,我已经尝试过了,但是没有用:((<
还有其他想法吗?
Hi,

yep, i have tried that and it didn''t work :((

any other ideas?


这篇关于组成员枚举限制...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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