Hash Files With Get-FileHash

Compute SHA-256 or other hashes as objects for comparison.

WindowshashFilessecurityLow risk
Run Get-FileHash .\installer.exe -Algorithm SHA256 to print the file hash.

01Command

Command
$ Get-FileHash .\installer.exe -Algorithm SHA256

02What it does

Get-FileHash returns a hash object, so verifying a download against a published checksum is a simple comparison in a script, and it works across platforms. Comparing manually character by character is exactly the kind of task worth automating.

03Risk

RiskLow risk
RequirementsWindows 10/11 with PowerShell 5.1 or PowerShell 7+
!Warning: A matching hash proves the file was not corrupted or altered, but only if the reference hash came from a trusted source.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • Get-FileHash
    Microsoft Learn · vendor-doc · 2026-09-20
    Evidence: Computes hashes of files using a chosen algorithm.

Last verified: 2026-10-13 · Category: Security & Privacy

06Related solutions