<?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: How to find a needle in the Array stack</title>
	<atom:link href="http://www.powershellpro.com/how-to-find-a-needle-in-the-array-stack/658/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.powershellpro.com/how-to-find-a-needle-in-the-array-stack/658/</link>
	<description>Sharing the Experience</description>
	<lastBuildDate>Mon, 06 Sep 2010 23:05:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jesse Hamrick</title>
		<link>http://www.powershellpro.com/how-to-find-a-needle-in-the-array-stack/658/comment-page-1/#comment-378</link>
		<dc:creator>Jesse Hamrick</dc:creator>
		<pubDate>Fri, 17 Jul 2009 00:09:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershellpro.com/?p=658#comment-378</guid>
		<description>Dean,
I am assuming your list of usernames are the SAM account name of the user and that the list is a text file with each username entered on their own line, separated by a carriage return.
CODE:
# ==================================================================
$Users = Get-Content &quot;C:\NameOfFile.txt&quot;

$Search = New-Object DirectoryServices.DirectorySearcher([ADSI]&quot;&quot;)

foreach($User in $users){
	$Search.Filter=&quot;(&amp;(objectClass=User)(sAMAccountName=$User))&quot;
	$objUsers = $Search.FindAll()	
	$objUsers
}
# ===================================================================

That will return the users who are in AD.

Hope that helps,</description>
		<content:encoded><![CDATA[<p>Dean,<br />
I am assuming your list of usernames are the SAM account name of the user and that the list is a text file with each username entered on their own line, separated by a carriage return.<br />
CODE:<br />
# ==================================================================<br />
$Users = Get-Content &#8220;C:\NameOfFile.txt&#8221;</p>
<p>$Search = New-Object DirectoryServices.DirectorySearcher([ADSI]&#8220;&#8221;)</p>
<p>foreach($User in $users){<br />
	$Search.Filter=&#8221;(&amp;(objectClass=User)(sAMAccountName=$User))&#8221;<br />
	$objUsers = $Search.FindAll()<br />
	$objUsers<br />
}<br />
# ===================================================================</p>
<p>That will return the users who are in AD.</p>
<p>Hope that helps,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dean</title>
		<link>http://www.powershellpro.com/how-to-find-a-needle-in-the-array-stack/658/comment-page-1/#comment-377</link>
		<dc:creator>Dean</dc:creator>
		<pubDate>Thu, 16 Jul 2009 23:14:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershellpro.com/?p=658#comment-377</guid>
		<description>I am wondering if you have a script that that takes a list of usernames and determines if those usernames are still in AD.  and returns a list of just the names that are still in AD?

any help would be appreciated.</description>
		<content:encoded><![CDATA[<p>I am wondering if you have a script that that takes a list of usernames and determines if those usernames are still in AD.  and returns a list of just the names that are still in AD?</p>
<p>any help would be appreciated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.powershellpro.com/how-to-find-a-needle-in-the-array-stack/658/comment-page-1/#comment-362</link>
		<dc:creator>John</dc:creator>
		<pubDate>Mon, 22 Jun 2009 14:45:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershellpro.com/?p=658#comment-362</guid>
		<description>I have to verify group sync against  control files on a scheduled basis for certain process here and this is what i do:

get the current email addresses from the members of my DL and out put the results to a file: Current.txt

Get-DistributionGroupMember dl-xxxxx &#124; get-mailbox &#124; select primarysmtpaddress &gt;&gt; c:\work\current.txt

Then compare that output file to my Control file: Address.txt

diff $(get-content C:\work\Address.txt)  $(get-content C:\work\current.txt)

The format of the address must match, it will detect spaces as a difference if there are trailing spaces after the address.

diff -  as you can see does compare the array contents. 
I know you can compare the output of the first command to the input file.. I just haven&#039;t spent the time trying to isolate the key from the value of the array of hashes with a one liner.</description>
		<content:encoded><![CDATA[<p>I have to verify group sync against  control files on a scheduled basis for certain process here and this is what i do:</p>
<p>get the current email addresses from the members of my DL and out put the results to a file: Current.txt</p>
<p>Get-DistributionGroupMember dl-xxxxx | get-mailbox | select primarysmtpaddress &gt;&gt; c:\work\current.txt</p>
<p>Then compare that output file to my Control file: Address.txt</p>
<p>diff $(get-content C:\work\Address.txt)  $(get-content C:\work\current.txt)</p>
<p>The format of the address must match, it will detect spaces as a difference if there are trailing spaces after the address.</p>
<p>diff &#8211;  as you can see does compare the array contents.<br />
I know you can compare the output of the first command to the input file.. I just haven&#8217;t spent the time trying to isolate the key from the value of the array of hashes with a one liner.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
