I am importing a csv. Each entry has 4 properties. The first property is completed and I need to use that property to obtain the other properties. I will be doing this in a foreach loop but apparently I don't quite understand how to get that information into the variable.
I was hoping that I could do something like this to fill in the values for SipAddress, sAMAccountName, Mailbox for use later on in the script. And yes they have to be together because at one point I need to take a returned value (Mailbox) and compare it against the variable to be able to pass the sAMAccountName to another command:
$test, here, is an array. What you would want to be changing is a property of $i, something like this:
foreach ($i in $test)
$user = Get-ADUser -Filter "emailAddress -eq '$($i.email)'"
$i.SamAccountName = $user.SamAccountName
# Other code to set SipAddress and Mailbox properties in $i in a similar way.
At this point, you've modified objects in memory. Later, you need to export them back to CSV: