Import
-Module
'C:\modules\DellWarrantyInfo\DellWarrantyInfoFunction.psm1'
Import
-Module
'C:\modules\OutTable\OutDataTable.psm1'
Add
-Type
-Path
'C:\Program Files\SoftArtisans\OfficeWriter\bin\dotnet\SoftArtisans.OfficeWriter.ExcelWriter.dll'
$myComputerList
=
'hvint01'
,
'tyche'
,
'eudora'
$xlt
=
New-Object
"SoftArtisans.OfficeWriter.ExcelWriter.ExcelTemplate"
$xlt
.Open(
"C:\templates\DellWarrantyLookup.xlsx"
)
$dataProps
=
$xlt
.CreateDataBindingProperties()
for(
$i
= 0;
$i
-le
$myComputerList
.Count - 1;
$i
++)
{
if(
$i
-eq
0){
$computer
= get
-DellWarranty
$myComputerList
[
$i
] | Out
-DataTable
}
else{
$nextcomputer
= get
-DellWarranty
$MyComputerList
[
$i
]
$workRow
=
$computer
.NewRow()
$workRow
[
'ComputerName'
] =
$nextcomputer
.ComputerName
$workRow
[
'ServiceTag'
] =
$nextcomputer
.ServiceTag
$workRow
[
'SystemType'
] =
$nextcomputer
.SystemType
$workRow
[
'EndDate'
] =
$nextcomputer
.EndDate
$workRow
[
'DaysLeft'
] =
$nextcomputer
.DaysLeft
$computer
.Rows.Add(
$workRow
)
}
}
$xlt
.BindData(
$computer
,
'Computer'
,
$dataProps
)
$xlt
.Process()
$xlt
.Save(
'C:\output\Output.xlsx'
)