by gosub100 · 2y ago · 0 comments
gci | select *, @{L='Hash'; E={ ($_ | Get-FileHash).Hash }}
Get-ChildItem |
Select-Object -Property FullName, CreationTime, Length,
@{Label='Hash'; Expression={ ($_ | get-filehash).Hash}}
but even then you could do what you want with a traditional loop and no pipeline: $results = foreach ($file in get-childitem) {
# a hashtable of things you want to be
# in each object ('row') of the output:
$data = @{
Name = $file.Name
SizeGB = $file.Length / 1GB
Hash = ($file | Get-FileHash).Hash
}
[pscustomobject]$data
}