Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

compare 2 cells in Excel

$
0
0

$Read1=Import-Csv"U:\reports\ad\test.csv"
$GetDepartment=$Read1.Department
$GetDesc=$Read1.DepartmentDesc
$GetMail=$Read1.email
foreach ($emailin$GetMail) { $email.remove($email.indexof("@"))}
$email

 

The above code works.  I have 3 columns in my Excel CSV file, Department, DepartmentDesc & Email.   The code above will strip off the @Acme.org from each email which is what I need. So I'm left with JonesSam instead of JonesSam@Acme.org   

In Active Directory I have an OU created for each Department + DepartmentDesc.   So it looks like this:

5023 Graphics

8305 Building Maintenance 

But how do I compare cells in Excel?  I need to do this:

If line two of my  CSV file has 5023 Graphics JonesSam@Acme.org I need to move user JonesSam into the 5023 Graphics OU in AD.

 

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles