Probably a really elementary question but preliminary searches didn't return much. I'm writing a script that takes ID's ($CSC) from a .csv and populates the relevant information based off that ID.
Foreach ($row in $roster) {
If ($CSC -eq $row.CSC) {
$Department = $row.Department
$Division = $row.Division
$Street = $row.Street
$City = $row.City
$State = $row.State
$Zipcode = $row.Zipcode
$OfficePhone = $row.Phone
$Country = $row.Country
} Else { }
}
That's working fine but how would I check if a user input ID didn't match an ID in the list?
Making the else or making an elseif ($CSC -ne $row) obviously returns a value for every line except the matching one. I'm guessing I should use a nested if statement but being self taught I wasn't sure what the best way to do this is. Thanks.
Aucun commentaire:
Enregistrer un commentaire