How many users do you have? How many users are in the CSV file?

Approximate, in both cases, is fine.

-----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

Reply via email to