I'm trying to create a text file with file names and their MD5 hash next to them. Doesn't really make sense, but it's for learning purposes.
This is how I calculate the hash:
$hash = Get-FileHash -Algorithm MD5 -Path $file | Select-Object Hash
Then I Out-File everything into a text file:
$file.Name + "`t`t" + $hash | Out-File -Append -FilePath ($destination + "inventory$i.txt")
Now every $hash value will look something like this:
@{Hash=2A396C91CB1DE5D7C7843970954CC1D4}
How can I get the "raw" Hash value from that string? Or is it even a string?
In my text file, I want it to look like this:
Name MD5 Hash
helloworld.txt 2A396C91CB1DE5D7C7843970954CC1D4
(By chance, does someone have a better idea for formatting this instead of using `t for tabulators?)