Created
May 18, 2015 12:58
-
-
Save MagicAndi/5e55ca26be02902d9508 to your computer and use it in GitHub Desktop.
PowerShell function to compute a MD5 checksum for a file. Based on an answer at http://stackoverflow.com/questions/10521061/how-to-get-an-md5-checksum-in-powershell. Note, this method works for files greater than 2GB in size.
This file contains 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 md5hash($path) | |
{ | |
$fullPath = Resolve-Path $path | |
$md5 = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider | |
$file = [System.IO.File]::Open($fullPath,[System.IO.Filemode]::Open, [System.IO.FileAccess]::Read) | |
[System.BitConverter]::ToString($md5.ComputeHash($file)) | |
$file.Dispose() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment