2025-03-14 21:59:59 -06:00
|
|
|
# Get-FileHash
|
|
|
|
|
|
2026-08-06 22:19:46 -06:00
|
|
|
> Calculate cryptographic checksums for a file.
|
2025-03-14 21:59:59 -06:00
|
|
|
> Note: This command can only be used through PowerShell.
|
|
|
|
|
> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/get-filehash>.
|
|
|
|
|
|
2026-08-06 22:19:46 -06:00
|
|
|
- Calculate the SHA256 checksum for a file:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
`Get-FileHash {{path\to\file}}`
|
|
|
|
|
|
2026-08-06 22:19:46 -06:00
|
|
|
- Calculate the checksum for a file using a specified algorithm:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-08-06 22:19:46 -06:00
|
|
|
`Get-FileHash {{path\to\file}} -Algorithm {{SHA1|SHA256|SHA384|SHA512|MD5}}`
|
|
|
|
|
|
|
|
|
|
- Calculate the checksum for a file using a deprecated algorithm (no longer available in PowerShell 6 or later):
|
|
|
|
|
|
|
|
|
|
`Get-FileHash {{path\to\file}} -Algorithm {{MACTripleDES|RIPEMD160}}`
|
|
|
|
|
|
|
|
|
|
- Check a known checksum of a file:
|
|
|
|
|
|
|
|
|
|
`(Get-FileHash {{path\to\file}} -Algorithm {{SHA1|SHA256|SHA384|SHA512|MD5}}).Hash -eq "{{known_hash}}"`
|