Created
September 20, 2021 19:09
-
-
Save vexx32/74bcbde8991a4bd27245313ebee4c406 to your computer and use it in GitHub Desktop.
checksum comparison for files vs a given checksum file
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 Test-Checksum { | |
[CmdletBinding()] | |
[Alias('checksum')] | |
param( | |
[Parameter(Mandatory, Position = 0)] | |
[string] | |
$Path, | |
[Parameter(Mandatory, Position = 1)] | |
[string] | |
$ChecksumPath | |
) | |
$reportedHash = Get-Content -Path $ChecksumPath | |
$actualHash = Get-FileHash -Path $Path | |
$actualHash.Hash -eq $reportedHash.Trim() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment