我希望从我的Powershell输出中创建一个表。 如果我只使用4列
,则输出正确Naam RFC Status Last_Modification_Date
---- --- ------ ----------------------
Daan 838065 Approved to Implement 2017-12-19T10:21:56
Daan 838061 Approved to Implement 2017-12-19T10:48:29
Daan 837103 Approved to Implement 2017-12-19T07:08:33
Daan 835761 Approved to Implement 2017-12-15T08:34:44
Daan 835762 Approved to Implement 2017-12-18T08:38:51
Daan 835748 Approved to Implement 2017-12-15T12:25:46
Daan 834721 Approved to Implement 2017-12-08T11:48:13
Daan 834656 Approved to Implement 2017-12-08T11:48:30
Daan 831541 Approved to Implement 2017-12-07T10:16:21
但是一旦我添加了一个列,我得到这种输出,我如何得到我喜欢的输出?
Naam : Theunis Daan
RFC : 837103
Status : Approved to Implement
Last_Modification_Date : 2017-12-19T07:08:33
Start : 1513317360
Naam : Theunis Daan
RFC : 835761
Status : Approved to Implement
Last_Modification_Date : 2017-12-15T08:34:44
Start : 1513238880
Naam : Theunis Daan
RFC : 835762
Status : Approved to Implement
Last_Modification_Date : 2017-12-18T08:38:51
Start : 1513253340
提供正确输出的代码是未注释的,我想要的完整输出是注释,但这给了我错误的输出样式。
foreach ($change in $Changes.objects) {
if ($change.assignee_full_name -eq "Daan"){
$Output = "" | select "Naam", "RFC", "Status", "Last_Modification_Date"
$Output.Naam = $change.assignee_full_name
$Output.RFC = $change.change_ref
$Output.Status = $change.change_status
$Output.Last_Modification_Date = $change.last_mod_date
Write-Output $Output
<#$temp = "" | select "RFC", "Summary", "Status", "Last_Modification_Date", "Start", "Need_By", "Assignee"
$temp.RFC = $change.change_ref
$temp.Summary = $change.change_summary
$temp.Status = $change.change_status
$temp.Last_Modification_Date = $change.last_mod_date
$temp.Start = $change.planned_date_timestamp
$temp.Need_By = $change.change_active_date_timestampe
$temp.Assignee = $change.assignee_full_name
Write-Output $temp #>
}
}