top of page

PowerShell Script to Get Hash Values of Multiple Files in Multiple Folders


Here's a PowerShell script that you can use to get the MD5 hash values of multiple files that are in a directory with multiple levels of subfolders:

PS C:\Users\SeanKOShea> Get-FileHash -Algorithm MD5 -Path (Get-ChildItem "C:\FooFolder\baseball2\*.*" -Recurse -force) | export-csv c:\FooFolder\Batch01b.csv

The Get-FileHash algorithm can be set to generate MD5, SHA1 and other hash values. Follow this command with the folder containing your source files. This will work even if the files are saved in multiple subdirectories, thanks to the, 'Recurse -force'. Enter a pipe | and then use the export-csv command to output the results to a comma separated value file.

The .csv file that is generated will look like this:

This PowerShell script will work if you list different directories in multiple copies of this one line script, put them on separate lines in PowerShell, and run them all at once.


bottom of page