<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sentiment &#187; ADSI</title>
	<atom:link href="http://wouter.shush.com/tag/adsi/feed" rel="self" type="application/rss+xml" />
	<link>http://wouter.shush.com</link>
	<description>About Life, the Universe, and Everything...</description>
	<lastBuildDate>Tue, 07 Feb 2012 19:27:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Adding members to groups with +1500 members in PowerShell</title>
		<link>http://wouter.shush.com/2007/10/adding-members-to-groups-with-1500-members-in-powershell?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=adding-members-to-groups-with-1500-members-in-powershell</link>
		<comments>http://wouter.shush.com/2007/10/adding-members-to-groups-with-1500-members-in-powershell#comments</comments>
		<pubDate>Fri, 19 Oct 2007 07:27:37 +0000</pubDate>
		<dc:creator>wooter</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[ADSI]]></category>
		<category><![CDATA[Windows 2003]]></category>

		<guid isPermaLink="false">http://wouter.shush.com/it-stuff/adding-members-to-groups-with-1500-members-in-powershell</guid>
		<description><![CDATA[The Windows Active Directory does not really have hard limits when it comes to group memberships. There are however soft limits. Any ADSI or WMI query to a list of your group memberships will turn out to 1000 members in &#8230; <a href="http://wouter.shush.com/2007/10/adding-members-to-groups-with-1500-members-in-powershell">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><!--:en-->The Windows Active Directory does not really have <a title="Active Directory limits" href="http://blogs.technet.com/mcs-ireland-infrastructure/archive/2006/10/14/active-directory-limits.aspx" target="_blank">hard limits</a> when it comes to group memberships. There are however soft limits.</p>
<p>Any ADSI or WMI query to a list of your group memberships will turn out to 1000 members in Windows 2000 mode, or 1500 in Windows 2003 native mode. Only by using <a title="List large groups" href="http://www.rlmueller.net/DocumentLargeGroup.htm" target="_blank">ADO range limits</a>, you can go by this soft limit.</p>
<p>This shouldn&#8217;t pose a problem when you are just adding members to an already big group. However, it does.<!--:--><span id="more-36"></span><!--:en--></p>
<pre lang="powershell" line="1">$userOU = [ADSI] "LDAP://cn=myUser,ou=Users,dc=contoso,dc=com"
$groupOU = [ADSI] "LDAP://cn=myGroup,ou=Users,dc=contoso,dc=com"
<strong>$groupOU.Member = $groupOU.Member + $userOU.distinguishedName
</strong>$groupOU.SetInfo()
</pre>
<p>Adding the myUser user to the myGroup group will work fine if the group member count is below 1500. Once above, your group will suddenly loose an amount of members until you are left with a group of just 1500 members, and then added by the new member.</p>
<p>What actually happens is self-explanatory when reading the code: the group members is the group member list plus the new member. When the group member list only returns 1500 members, and then you add one member, you are left with 1501 members, and not your original amount of members + 1.</p>
<p>A workaround is this:</p>
<pre lang="powershell" line="1">$ADS_PROPERTY_APPEND = 3
$userOU = [ADSI] "LDAP://cn=myUser,ou=Users,dc=contoso,dc=com"
$groupOU = [ADSI] "LDAP://cn=myGroup,ou=Users,dc=contoso,dc=com"
<strong>$groupOU.putEx($ADS_PROPERTY_APPEND, "member", @($userOU.distinguishedname))</strong>
$groupOU.SetInfo()</pre>
<p>In this workaround, we are going to use <a title="HOW TO: Use ADSI to Set LDAP Directory Attributes" href="http://support.microsoft.com/kb/260251" target="_blank">putEx</a> to append a member to a group, instead of loading the full member list (with a limit of 1500) and then adding a new member.</p>
<p><a title="ADSI and group membership - what am I doing wrong - Neil Chambers " href="http://www.eggheadcafe.com/software/aspnet/30327382/adsi-and-group-membership.aspx" target="_blank">Source</a>.<!--:--></p>
]]></content:encoded>
			<wfw:commentRss>http://wouter.shush.com/2007/10/adding-members-to-groups-with-1500-members-in-powershell/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: wouter.shush.com @ 2012-02-08 00:30:37 -->
