Checking the hash (checksum) of a downloaded file is crucial for ensuring its integrity and verifying that the contents have not been altered. This verification process is particularly vital for operating system distributions and software installation images, where ensuring the file’s authenticity is essential.
A checksum is calculated using a specific hashing algorithm, typically MD5, SHA1, or SHA256. Users can perform the same operation on their downloaded file and compare the resulting hash values. If both hashes match, the file is confirmed to be the original and unchanged. If they differ, the file may have been modified or corrupted.
Verifying File Hash Using PowerShell
To check a file’s hash in Windows, you can use the Get-FileHash
cmdlet in PowerShell. For instance:
Get-FileHash "F:ISOWindows_server_2025_EVAL_x64FRE_en-us.iso"
This command will return the file’s checksum using the SHA-256 algorithm, which is the default. Depending on the file size, calculating the hash can take some time. You can also specify a different algorithm using the -Algorithm
attribute:
- SHA1
- SHA256 (default, widely used due to low collision probability)
- SHA384
- SHA512
- MD5 (the fastest, but less secure)
Using Certutil to Get File Hash
Additionally, you can use the certutil
tool to get the file’s hash:
certutil -hashfile "F:ISOWindows_server_2025_EVAL_x64FRE_en-us.iso" SHA256
Finding Original ISO Image Checksums
To obtain checksums for Microsoft Windows ISO images, check your Microsoft account at Visual Studio Downloads. You don’t need an active MSDN subscription; look under the Product Info tab for checksum values.
For further verification, a third-party online database such as rg-adguard can be useful. This site allows you to search for ISO images based on their hash values, helping ensure you’ve downloaded the original ISO file.
Automating Hash Verification in PowerShell
For automating the hash verification process, you can use a PowerShell one-liner like:
((get-filehash .Windows_server_2025_EVAL_x64FRE_en-us.iso).hash) -eq "D0EF4502E350E3C6C53C15B1B3020D38A5DED011BF04998E950720AC8579B23D"
If the command returns True, it confirms that the file checksum matches the expected hash value. This automation enhances speed and accuracy in verifying downloaded files.