Created
August 7, 2015 02:06
-
-
Save lanekatris/49862efa287a27971002 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Function / CmdLet that compares the MD5 hash of a file to a expected hash passed in via an argument | |
| # Put in powershell profile ($profile) if you want it as a global function, or put it into a module to be imported | |
| function Check-Hash ($file, $expectedHash) | |
| { | |
| $result = (Get-FileHash $file -Algorithm MD5).Hash.ToLower() -eq $expectedHash.Trim().ToLower() | |
| if ($result -eq $true) { | |
| Write-Host $result -ForegroundColor Green | |
| } else { | |
| Write-Host $result -ForegroundColor Red | |
| } | |
| } | |
| # How to use | |
| # Check-Hash C:\users\User1\Downloads\VMware-converter-en-6.0.0-2716716.exe "f64589b50f416ebf5de547a402b091cb" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment