• Compare file hash with PowerShell

    by  • 2017/09/05 • Tech • 0 Comments

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

    Then use PowerShell to compare this to the published hash.
    $webhash = "3...f' [Paste the full SHA256 hash in the quotes]
    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.]

    About

    Clint McGuire is a Computer Consultant based out of Vancouver Canada. He specializes in VMware and Storage.

    Leave a Reply

    Your email address will not be published. Required fields are marked *