Check the hash on a file using PowerShell

Checking the hash of a file you’ve downloaded from the internet is very good practice. It’s a way to ensure the file you’re downloading hasn’t been tampered with, according to the hash provided on the site you’re downloading from.

Since Powershell 4.0, Get-FileHash has been a way to check the hash signature of a file.

A powershell windows showing the Get-FileHash command

Get-FileHash -Path C:\Path\to\file\file.exe -Algorithm SHA256

Get-FileHash can check the following signatures:

  • SHA1
  • SHA256 (default value)
  • SHA384
  • SHA512
  • MACTripleDES
  • MD4
  • RIPEMD160
Advertisements