PowerShell File Hash Calculator Script

File Hash Calculator in PowerShell

This File Hash Calculator Script in PowerShell lets you calculate a hash of a given file and compares it with the original hash/checksum the user provides.

The Get-FileHash cmdlet computes the hash value for a file by using a specified hash algorithm. A hash value is a unique value that corresponds to the content of the file. Rather than identifying the contents of a file by its file name, extension, or other designation, a hash assigns a unique value to the contents of a file.

Simply execute the Script and follow the Steps for the hash calculation and verfication by choosing the menu point. You will have to provide a path to the file you want to calculate and you will have to paste the original hash/checksum to compare it. Currently this script supports every method which the cmdlet Get-FileHash supports.

  • MACTripleDES
  • MD5
  • RIPEMD160
  • SHA1
  • SHA256
  • SHA384
  • SHA512

Simply execute the Script in a opened up PowerShell.

PowerShell File Hash Calculator Script Execution of the Script

After executing the script you will be presented a menu to choose which algorithm you want to calculate.

PowerShell File Hash Calculator Script Script Menu

If you are calculating big files, the Script will show a progress bar, so you know the file is beeing calculated.

PowerShell File Hash Calculator Script Image of the progess bar

The Script will tell you if your file and the provided checksum is valid or not.

Example of a valid hash:

PowerShell File Hash Calculator Script Image of a valid hash

Example of a non valid hash:

PowerShell File Hash Calculator Script Image of a non valid hash

The script also checks for a correct user input. If the file doesn’t exist which the user provides, it throws an error message.

Missing Input File

Have fun with the File Hash Calculator Script in PowerShell ! I always love feedback, so write a comment or leave me a message on social media.

You can get the Script on my Github Page: File Hash Calculator Script

Here is the link to the Get-FileHash Command on the Microsoft docs page

About Falko Banaszak

Falko is a consultant based in Germany working for SVA GmbH. He has a strong focus on virtualization, data backup, disaster recovery infrastructures and a passion for Microsoft 365 & storage systems. He´s a VMware vExpert & Veeam user group leader in Germany. VCP-DCV, VMCE, VMCA.

Check Also

VMware PowerCLI logo

Get vSphere Tags out of a category with PowerCLI

Introduction to vSphere Tags Using vSphere tags in your VMware environment is no longer a …

Leave a Reply

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