我不确定脚本有什么问题。我有一个 3 列的 csv 文件,其中包含Name,Count,Owner
. 目标是获得每个名称的最高计数,然后输出所有 3 列,但是该Owner
列没有输出。我只是得到Name, Total
。如果有人能帮助我告诉我出了什么问题,我将不胜感激,非常感谢。
$total = Import-Csv -Delimiter ',' -Path "file.csv"
$total = $total | Group-object -Property Name | Select Name, @{ N = 'Total';E = {($_.Group | Measure-Object -Property count -Maximum).Maximum }},Owner
csv文件内容:
"Name","Count","Owner"
"ctx_Prd-DG","1","User1"
"PRD-Fa","5","User2"
"ING-PROD","3","User2"
"PROD-DG03","0","User2"
"PROD-DG01","0","User2"
"PRD-2018-DG","1","User3"
"PRD-7-DG","5","User3"
"PRD-7-DG-PR15","0","User3"
"PRD-CS-DG","0","User3"
"PRD-INSIGHT-DG","0","User3"
"PRD-LIVE-DG","0","User3"
"DC01-DG","0","User4"
"Test - DG","0","User4"
"PRD-CS-DG","0","User3"
"INSIGHT-DG","0","User3"
"ctx_Prd-DG","1","User1"
"PRD-Fa","1","User2"
"ING-PROD","0","User2"
"PROD-DG03","0","User2"
"PROD-DG01","0","User2"
"PRD-2018-DG","7","User3"
"PRD-7-DG","5","User3"
"PRD-7-DG-PR15","0","User3"
"PRD-CS-DG","0","User3"
"PRD-INSIGHT-DG","0","User3"
"PRD-LIVE-DG","2","User3"
"DC01-DG","1","User4"
"Test - DG","8","User4"
"PRD-CS-DG","20","User3"
"INSIGHT-DG","0","User3"