<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How Can I Count the Number of Users in a Group?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2007/09/19/how-can-i-count-the-number-of-users-in-a-group.aspx</link><description>Hey, Scripting Guy! How can I count the number of users in an Active Directory group? -- TP 
 Hey, TP. You know, it’s our sad duty to confirm that the reports currently sweeping the Internet are true. Without wishing to alarm anyone, we must admit that</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: How Can I Count the Number of Users in a Group?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2007/09/19/how-can-i-count-the-number-of-users-in-a-group.aspx#3491129</link><pubDate>Mon, 09 Apr 2012 23:14:07 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3491129</guid><dc:creator>Peter V</dc:creator><description>&lt;p&gt;For just a simple search using joeware.net (free tool) adfind you can... Copy the below into a batch file and execute with adfind.exe in the same directory. &lt;/p&gt;
&lt;p&gt;-------------------------------------------------------------------------------------------------------------------------&lt;/p&gt;
&lt;p&gt;for /f &amp;quot;delims=&amp;quot; %%i in (&amp;#39;adfind -default -rb ou^=groups -f objectclass^=group distinguishedName -list&amp;#39;) do (&lt;/p&gt;
&lt;p&gt;	for /f %%b in (&amp;#39;adfind -list -c -f ^&amp;quot;memberof^=%%i^&amp;quot; -c&amp;#39;) do echo &amp;quot;%%i&amp;quot;,%%b&amp;gt;&amp;gt; allgroupscount.csv&lt;/p&gt;
&lt;p&gt;	)&lt;/p&gt;
&lt;p&gt;-------------------------------------------------------------------------------------------------------------------------&lt;/p&gt;
&lt;p&gt;Explanation of Above (remarked out for my batch file.)&lt;/p&gt;
&lt;p&gt;rem del d:\sharetest\allgroupscount.csv removes old output file so data is not appended&lt;/p&gt;
&lt;p&gt;REm &amp;quot;delims=&amp;quot; ignores all delimiters (spaces) and reads entire line&lt;/p&gt;
&lt;p&gt;REm &amp;nbsp;%%i in (&amp;#39;adfind -default -rb ou^=groups -f objectclass^=group distinguishedName -list&amp;#39;) passes the output of adfind to for loop&lt;/p&gt;
&lt;p&gt;REM do ( allows for mulit function call from for loop&lt;/p&gt;
&lt;p&gt;REM for /f %%b in (&amp;#39;adfind -list -c -f ^&amp;quot;memberof^=%%i^&amp;quot; -c&amp;#39;) do echo &amp;quot;%%i&amp;quot;,%%b&amp;gt;&amp;gt; d:\sharetest\allgroupscount.csv nested for loop that passes variables to csv file&lt;/p&gt;
&lt;p&gt;rem ) end of for loop multi call&lt;/p&gt;
&lt;p&gt;rem the caret symbol ^ is an escape character telling &amp;#39;for&amp;#39; not to treat the following character as a control character.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3491129" width="1" height="1"&gt;</description></item><item><title>re: How Can I Count the Number of Users in a Group?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2007/09/19/how-can-i-count-the-number-of-users-in-a-group.aspx#3444575</link><pubDate>Mon, 01 Aug 2011 22:22:43 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3444575</guid><dc:creator>OurTech</dc:creator><description>&lt;p&gt;So can we use this script to output to a CSV with groups in an OU and how many users are in each group? &amp;nbsp;How would we go about that?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3444575" width="1" height="1"&gt;</description></item></channel></rss>