1 2 3 4 5 6 7
param([string]$file, [string]$hash); $hashFromFile = Get-FileHash -Path $file -Algorithm SHA256 if ($hashFromFile.Hash -ne $hash) { Throw 'Hash mismatch!' }