Get-Dellwarranty - Multiple entries tied to single service tag

Greetings Powershell peers, first time post here.

Goal : Use this Get-DellWarranty script to “get” warranty information, export to csv, then manipulate via excel to generate reports. My servieTags.csv contains the fields computername, serial

$computers = import-csv .\serviceTags.csv
$data1 = $computers | select name, @{name='serial'; exp={ForEach-Object -Process{(Get-DellWarranty -ServiceTag $PSItem.serial).serial}}},
@{name='model'; exp={ForEach-Object -Process{(Get-DellWarranty -ServiceTag $PSItem.serial).model}}},
@{name='Enddate'; exp={ForEach-Object -Process{(Get-DellWarranty -ServiceTag $PSItem.serial).enddate -as [datetime]}}},
@{name='startdate'; exp={ForEach-Object -Process{(Get-DellWarranty -ServiceTag $PSItem.serial).startdate -as [datetime] }}}
|| Export-ToCsv .\DellWarranty.csv

And here is the resulting output exported to csv

Name serial model Enddate startdate
comp1 G81BRP2 Precision 5820 Tower 6/8/2021 23:59 6/9/2018 0:00
comp2 G817RP2 Precision 5820 Tower 6/8/2021 23:59 6/9/2018 0:00
comp3 G824RP2 Precision 5820 Tower 6/8/2021 23:59 6/9/2018 0:00
comp4 4MLYZ12 4MLYZ12 OptiPlex 3020 OptiPlex 3020
comp5 4RPYZ12 4RPYZ12 4RPYZ12 OptiPlex 3020 OptiPlex 3020 OptiPlex 3020
comp6 4MCVZ12 4MCVZ12 OptiPlex 3020 OptiPlex 3020
Issue : As can be seen from table above, some serial numbers return multiple "serial" objects and return an empty value on the "startdate" and 'enddate" field. How can get this field to display individually?

My powershell level is a beginner who just completed “powershell in a month of lunches” book. Any input is appreciated.


Didn’t get here on what you meant by individually, can you post your expected output here.

Creating a second property “EndDateFor9020s” by adding line below. That helped fix my issue.

@{name=‘EndDateForNon9020’; exp={ForEach-Object -Process{(Get-DellWarranty -ServiceTag $PSItem.serial).enddate -as [datetime]}}}


Very thankful for the interest to help.

Can be marked “closed”