Last active
October 24, 2023 13:07
-
-
Save EricTurner3/efb7c42c25ac6d0ade1a70efbdd4d402 to your computer and use it in GitHub Desktop.
PowerShell Get All Hashes of File (Get-FileHash)
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
<# | |
Get-FileHash Extended | |
Returns all hashes from the supported algorithms in one response | |
Allows filepath to be used directly from an argument or prompt after the script is ran | |
#> | |
param( | |
[string]$FilePath | |
) | |
# handle missing arg | |
if ($FilePath -eq $null -or $FilePath -eq "") {$FilePath = Read-Host "Drag and drop file here, or enter full filepath"} | |
# all algorithms here | |
$algorithms = "MD5","SHA1","SHA256","SHA384","SHA512","MACTripleDES","RIPEMD160" | |
%{ | |
foreach ($alg in $algorithms){ | |
Get-FileHash -Algorithm $alg -Path $FilePath; | |
} | |
} | Format-Table -Wrap -Property Algorithm, Hash | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment