Let me try this again :)

What I have is a csv file that has a name and logonname column and then several other columns. To make it easier I've called them colour names. Each colour name may contain a "Yes" in that cell.

I have a powershell script that will only act upon one row at a time (a vendor tool). So it will read the value of Name and create an account, I write the logon name (samAccountName) into LogonName column beside that user.

This part works of the script works fine and uses import-csv and a Foreach($row in $csv) and writes logon name via $row.logonname

What I'm looking for is to add to my script so that it looks for "Yes" in any and all columns on the row of that user(Name) and if it finds a "Yes" then I'm sending an email with the a body containing Name LogonName and then headername: Yes Which should look like this:

Name:John Smith  

LogonName:jsmith   

Blue:Yes  

Green:Yes  

I have an input csv file "test.csv" that contains:

| Name | LogonName | Blue | Red | Green |
| --- | --- | --- | --- | --- |
| John Smith |  | Yes |  | Yes |

My working section is:

```
    $csv = import-Csv $testFile
    Foreach($row in $csv){
        $PersonName = $row.name
        if ($PersonName -eq $($nameVariable)){
            $row.LogonName = $($userVariable)
            $row.Password = $($passwordVariable)
        }       
     }

$csv | Export-CSV $testFile -NoTypeInformation

```

Sorry about all the confusion and poorly worded versions.

Thank you!