Ok, small enough to do a brute force search.

In pseudo-code (I don't use QAD and I didn't test it)

        $AllCSVUsers = @(Import-CSV $InputFileName) 
        $TotCntCSVUsers =  $AllCSVUsers.count

        foreach( $row in $AllCSVUsers )
        {
                $user = Get-AdUser -Filter { ( GivenName -eq $row.FirstName ) 
-and ( Surname -eq $row.LastName ) } -SearchBase "dc=contoso,dc=local" 
-SearchScope Subtree
                if( $user )
                {
                        ### you found a record for matching firstname and 
lastname
                }
                else
                {
                        ### no such record
                }
        }

-----Original Message-----
From: Michael Leone [mailto:[email protected]] 
Sent: Tuesday, March 5, 2013 11:15 AM
To: NT System Admin Issues
Subject: Re: Powershell advice - matching an AD user to a value in an array

On Tue, Mar 5, 2013 at 11:05 AM, Michael B. Smith <[email protected]> wrote:
> How many users do you have? How many users are in the CSV file?
>
> Approximate, in both cases, is fine.

CSV users = 1300. AD users = <1100.

What I am most interested in: AD users NOT in CSV file. There will always be 
users in CSV file not in AD; that is fine. What I need to know is - who is in 
AD that isn't accounted for, in the CSV file.

>
> -----Original Message-----
> From: Michael Leone [mailto:[email protected]]
> Sent: Tuesday, March 5, 2013 10:54 AM
> To: NT System Admin Issues
> Subject: Powershell advice - matching an AD user to a value in an 
> array
>
> So I have this CSV file of names (LastName, FirstName). What I need to
> do: find every AD user that is in that CSV file. If they are not there, 
> report that, too.
>
> So I imported the whole CSV into an array, and use Quest to get all active 
> user objects:
>
> $AllCSVUsers = @(Import-CSV $InputFileName) $TotCntCSVUsers = 
> $AllCSVUsers.count
>
> $AllUsers = Get-QADUser -SizeLimit 0 | Select 
> LastName,givenName,DisplayName
>
> But I am unclear on how to (easily) search each AD user against the CSV array.
>
> ForEach ($AD_User in $AllUsers)
> {
> $LastName=$AD_User.LastName
> $FirstName=$AD_User.FirstName
>
> - then what? Do loop thru the CSVUsers array, looking for both $LastName and 
> $FirstName? Can Compare-Object help me here?
>
> I foresee problems, especially if the names don't match exactly, or I have 
> multiple John Does. But all I have is that CSV file.
>
> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ 
> <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~
>
> ---
> To manage subscriptions click here: 
> http://lyris.sunbelt-software.com/read/my_forums/
> or send an email to [email protected]
> with the body: unsubscribe ntsysadmin
>
> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ 
> <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~
>
> ---
> To manage subscriptions click here: 
> http://lyris.sunbelt-software.com/read/my_forums/
> or send an email to [email protected]
> with the body: unsubscribe ntsysadmin
>

~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ 
<http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin

Reply via email to