I have the following pscutomobject
$output = [PSCustomObject]@{
'#' = ''
'Report Path' = ''
'Schedule ID' = ''
Status = ''
}
i have a foreach loop and i add values for each iteration into the pscustomobject
foreach ($refreshSchedulePlanId in $reportRefreshScheduleSubscriptionIdDataWithoutHeader)
{
$output.'#' = $iteration
$output.'Report Path' = $($reportRefreshScheduleSubscriptionIdDataWithoutHeader[$loopCount])
$output.'Schedule ID' = $refreshSchedulePlanId
$output.Status = $status
$output | ft
}
but its outputting this way:
# Report Path Schedule ID Status
1 report1/rep1 0998989898 success
# Report Path Schedule ID Status
2 report2/re2 76767868767 fail
it should output:
# Report Path Schedule ID Status
1 report1/rep1 0998989898 success
2 report2/re2 76767868767 fail
etc..