Last active
January 29, 2024 11:46
-
-
Save jfalava/ebdccb80d0814d42f0a1f37a3b053d34 to your computer and use it in GitHub Desktop.
PowerShell script to calculate the hash of all files with an specific extension in a folder and returns it neatly into a .txt file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$folderPath = "path\to\folder" | |
$outputFilePath = "path\to\txt\file\hash.txt" | |
$scanFiles = Get-ChildItem -Path $folderPath -Filter "*.extension" | |
$hashes = foreach ($file in $scanFiles) { | |
$hash = Get-FileHash -Path $file.FullName -Algorithm SHA256 | |
[PSCustomObject]@{ | |
FileName = $file.Name | |
Hash = $hash.Hash | |
} | |
} | |
$hashes | Export-Csv -Path $outputFilePath -NoTypeInformation -Delimiter "`t" -Encoding UTF8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment