Commit 93cc08e6 by root Committed by James Cammarata

Applying bf916fb5 fix to v2

parent 805e83d2
......@@ -142,3 +142,25 @@ Function ConvertTo-Bool
return
}
# Helper function to calculate md5 of a file in a way which powershell 3
# and above can handle:
Function Get-FileMd5($path)
{
$hash = ""
If (Test-Path -PathType Leaf $path)
{
$sp = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider;
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read);
[System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
ElseIf (Test-Path -PathType Container $path)
{
$hash= "3";
}
Else
{
$hash = "1";
}
return $hash
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment