$data = Import-Csv -Path "C:\Users\eeckert\Downloads\NoteVault licenses.csv" foreach ($set in $data) { $userCode = ($set.'Assigned User').Substring(0,($set.'Assigned User').IndexOf(('@'))) $set.Office = $userCode | Get-ADUser -property office | select office } $data | Export-Csv -Path "C:\Users\eeckert\Downloads\NoteVault licenses.csv" -NoTypeInformation