<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
	
	>
<channel>
	<title>
	Comments on: Counting the Number of AD User Accounts in PowerShell	</title>
	<atom:link href="https://www.kjctech.net/counting-the-number-of-ad-user-accounts-in-powershell/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.kjctech.net/counting-the-number-of-ad-user-accounts-in-powershell/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=counting-the-number-of-ad-user-accounts-in-powershell</link>
	<description></description>
	<lastBuildDate>Tue, 24 Jan 2023 18:21:00 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>
		By: Jean-Claude DuBois		</title>
		<link>https://www.kjctech.net/counting-the-number-of-ad-user-accounts-in-powershell/comment-page-1/#comment-259275</link>

		<dc:creator><![CDATA[Jean-Claude DuBois]]></dc:creator>
		<pubDate>Thu, 20 Oct 2022 15:28:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.kjctech.net/?p=3544#comment-259275</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.kjctech.net/counting-the-number-of-ad-user-accounts-in-powershell/comment-page-1/#comment-213409&quot;&gt;BAD ADVICE&lt;/a&gt;.

Why not?  If you going to make such a bold claim (and do it anonymously), why not say why you feel this was wrong, instead of just YELLING don&#039;t do it?

There are better ways, and I presented on below.  But you criticize but can&#039;t even bother to say why?]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.kjctech.net/counting-the-number-of-ad-user-accounts-in-powershell/comment-page-1/#comment-213409">BAD ADVICE</a>.</p>
<p>Why not?  If you going to make such a bold claim (and do it anonymously), why not say why you feel this was wrong, instead of just YELLING don&#8217;t do it?</p>
<p>There are better ways, and I presented on below.  But you criticize but can&#8217;t even bother to say why?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jean-Claude DuBois		</title>
		<link>https://www.kjctech.net/counting-the-number-of-ad-user-accounts-in-powershell/comment-page-1/#comment-259274</link>

		<dc:creator><![CDATA[Jean-Claude DuBois]]></dc:creator>
		<pubDate>Thu, 20 Oct 2022 15:25:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.kjctech.net/?p=3544#comment-259274</guid>

					<description><![CDATA[Might I suggest a more efficient way to do this?  The problem here is your fetching all the data then filtering it.  Why not instead filter it BEFORE fetching it.
Instead of:
   (Get-AdUser -filter * &#124;Where {$_.enabled -eq &quot;True&quot;}).count
try:
  (Get-Aduser - filter {enabled -eq $true}).count
and instead of
  (Get-ADUser -filter * &#124;Where {$_.enabled -ne &quot;False&quot;}).count
try
  (Get-Aduser - filter {enabled -eq $false}).count 

In my domain, I have some 600,000 users.  This change meant that instead of fetching all of the accounts, only to later throw away the data on enabled or disabled, I instead only collected the information that was needed]]></description>
			<content:encoded><![CDATA[<p>Might I suggest a more efficient way to do this?  The problem here is your fetching all the data then filtering it.  Why not instead filter it BEFORE fetching it.<br />
Instead of:<br />
   (Get-AdUser -filter * |Where {$_.enabled -eq &#8220;True&#8221;}).count<br />
try:<br />
  (Get-Aduser &#8211; filter {enabled -eq $true}).count<br />
and instead of<br />
  (Get-ADUser -filter * |Where {$_.enabled -ne &#8220;False&#8221;}).count<br />
try<br />
  (Get-Aduser &#8211; filter {enabled -eq $false}).count </p>
<p>In my domain, I have some 600,000 users.  This change meant that instead of fetching all of the accounts, only to later throw away the data on enabled or disabled, I instead only collected the information that was needed</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Kevin Kekoa		</title>
		<link>https://www.kjctech.net/counting-the-number-of-ad-user-accounts-in-powershell/comment-page-1/#comment-256885</link>

		<dc:creator><![CDATA[Kevin Kekoa]]></dc:creator>
		<pubDate>Tue, 20 Sep 2022 18:43:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.kjctech.net/?p=3544#comment-256885</guid>

					<description><![CDATA[Thank you!]]></description>
			<content:encoded><![CDATA[<p>Thank you!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Mike Virata		</title>
		<link>https://www.kjctech.net/counting-the-number-of-ad-user-accounts-in-powershell/comment-page-1/#comment-246817</link>

		<dc:creator><![CDATA[Mike Virata]]></dc:creator>
		<pubDate>Mon, 07 Mar 2022 19:57:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.kjctech.net/?p=3544#comment-246817</guid>

					<description><![CDATA[You are the best, thanks!]]></description>
			<content:encoded><![CDATA[<p>You are the best, thanks!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: BAD ADVICE		</title>
		<link>https://www.kjctech.net/counting-the-number-of-ad-user-accounts-in-powershell/comment-page-1/#comment-213409</link>

		<dc:creator><![CDATA[BAD ADVICE]]></dc:creator>
		<pubDate>Sun, 19 Jul 2020 09:15:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.kjctech.net/?p=3544#comment-213409</guid>

					<description><![CDATA[DO NOT FOLLOW THIS BLOG ARTICLES RECOMMENDATIONS!]]></description>
			<content:encoded><![CDATA[<p>DO NOT FOLLOW THIS BLOG ARTICLES RECOMMENDATIONS!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: schoepp		</title>
		<link>https://www.kjctech.net/counting-the-number-of-ad-user-accounts-in-powershell/comment-page-1/#comment-213338</link>

		<dc:creator><![CDATA[schoepp]]></dc:creator>
		<pubDate>Tue, 14 Jul 2020 19:43:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.kjctech.net/?p=3544#comment-213338</guid>

					<description><![CDATA[This code for &quot;Total number of enabled/disabled accounts in AD&quot; has too many errors...
Yes it works but it is not clear on first look why.
And you can find it via google... So here is the correct version:

(Get-AdUser -filter &#039;Enabled -eq $true&#039;).count # This gets the number of enabled accounts
The difference here is filtering on the AD site with a filter instead of using -Filter * and more importantly not comparing a boolean value (Enabled) to a string since casting string to bool nearly always equals $true
Same with the disabled accounts:
(Get-AdUser -filter &#039;Enabled -eq $false&#039;).count
Same stuff here. Use a filter on the AD site of things. Compare with actual boolean values. Don&#039;t switch around the comparison &#039;-ne&#039; vs &#039;-eq&#039; in the first example to make the commands understandable.]]></description>
			<content:encoded><![CDATA[<p>This code for &#8220;Total number of enabled/disabled accounts in AD&#8221; has too many errors&#8230;<br />
Yes it works but it is not clear on first look why.<br />
And you can find it via google&#8230; So here is the correct version:</p>
<p>(Get-AdUser -filter &#8216;Enabled -eq $true&#8217;).count # This gets the number of enabled accounts<br />
The difference here is filtering on the AD site with a filter instead of using -Filter * and more importantly not comparing a boolean value (Enabled) to a string since casting string to bool nearly always equals $true<br />
Same with the disabled accounts:<br />
(Get-AdUser -filter &#8216;Enabled -eq $false&#8217;).count<br />
Same stuff here. Use a filter on the AD site of things. Compare with actual boolean values. Don&#8217;t switch around the comparison &#8216;-ne&#8217; vs &#8216;-eq&#8217; in the first example to make the commands understandable.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Pandia		</title>
		<link>https://www.kjctech.net/counting-the-number-of-ad-user-accounts-in-powershell/comment-page-1/#comment-212391</link>

		<dc:creator><![CDATA[Pandia]]></dc:creator>
		<pubDate>Tue, 09 Jun 2020 14:39:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.kjctech.net/?p=3544#comment-212391</guid>

					<description><![CDATA[Really Good]]></description>
			<content:encoded><![CDATA[<p>Really Good</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Marlon		</title>
		<link>https://www.kjctech.net/counting-the-number-of-ad-user-accounts-in-powershell/comment-page-1/#comment-208865</link>

		<dc:creator><![CDATA[Marlon]]></dc:creator>
		<pubDate>Mon, 27 Jan 2020 04:52:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.kjctech.net/?p=3544#comment-208865</guid>

					<description><![CDATA[hi,
is that possible to count the aduser every 1000 objects and parse to csv file every completed 1000 objects and continue again after parsing to csv file?
please advise on how to achieve and how to construct in powershell
Thanks]]></description>
			<content:encoded><![CDATA[<p>hi,<br />
is that possible to count the aduser every 1000 objects and parse to csv file every completed 1000 objects and continue again after parsing to csv file?<br />
please advise on how to achieve and how to construct in powershell<br />
Thanks</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Meo		</title>
		<link>https://www.kjctech.net/counting-the-number-of-ad-user-accounts-in-powershell/comment-page-1/#comment-198776</link>

		<dc:creator><![CDATA[Meo]]></dc:creator>
		<pubDate>Fri, 26 Apr 2019 08:03:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.kjctech.net/?p=3544#comment-198776</guid>

					<description><![CDATA[it helped me thanks.]]></description>
			<content:encoded><![CDATA[<p>it helped me thanks.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: ADEL		</title>
		<link>https://www.kjctech.net/counting-the-number-of-ad-user-accounts-in-powershell/comment-page-1/#comment-197952</link>

		<dc:creator><![CDATA[ADEL]]></dc:creator>
		<pubDate>Mon, 15 Apr 2019 17:53:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.kjctech.net/?p=3544#comment-197952</guid>

					<description><![CDATA[Thanks a lot, very useful.]]></description>
			<content:encoded><![CDATA[<p>Thanks a lot, very useful.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
