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 |
My powershell level is a beginner who just completed “powershell in a month of lunches” book. Any input is appreciated.