Compare file hash with PowerShell

User PowerShell to check file hash

Once you’ve downloaded the file use Get-FileHash to calculate the SAH256 hash.
$hash = (Get-FileHash .\filename.exe).hash

Set the copy the hash valie from the website and assign it to a variable to compare.
$webhash = “3…f’ [Paste the full SHA256 hash in the quotes]

Then use PowerShell to compare this to the published hash.
if ($hash -eq $webhash){$true}

If this returns “True” then the hashes match.

Or if you want to do it in one line: If ((Get-FileHash .\filename.exe).hash -eq “3..f”){$True}
[Published SHA256 goes in the quotes.]

comments powered by Disqus