I have a source .csv file with columnA `emailaddress` and columnB `Is this mailbox still in use?`.

I need to read the file, find the ADUser's `SamAccountName` based on the given `emailaddress` attribute and then where columnB = `NO` delete any AD accounts. If column B = `YES` update attributes.

The 2nd part, if `Yes` works great but I can't get the first part working as I'm not sure how to get and then pass the `SamAccountName` to the `Remove-ADUser` command. Any suggestions would be great.

```
$Users = Import-Csv $SurveyResults
foreach ($user in $users) { 
    if ($($user."Is this mailbox still in use?") -eq "NO") {
        Get-ADUser -Filter "emailaddress -eq '$($user.emailaddress)'" -Property SamAccountName |
            Select-Object -Property emailaddres, samaccountname, wwWHomePage |
            Remove-ADUser -Identity $_.SamAccountName -Confirm:$False
    }
    else {
        Get-ADUser -Filter "emailaddress -eq '$($user.emailaddress)'" -Properties * |
            Set-AdUser -replace @{wWWHomePage = "$($_.wWWHomePage) ACTIVE $(get-date -f yyyy-MM)"}
    }
}

```