move get-content into try, silence errors

This commit is contained in:
Asif Bacchus 2020-06-20 07:33:48 -06:00
parent 8a04d654ef
commit ac41f6fe48
1 changed files with 1 additions and 2 deletions

View File

@ -45,9 +45,8 @@ function hashSHA($type){
}
function doHash($file, $hash){
$fileContents = Get-Content $file -Raw
$fileContents = Get-Content $file -Raw -ErrorAction SilentlyContinue
try {
$fileContents = Get-Content $file -Raw -ErrorAction SilentlyContinue
$hashBytes = $hash.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($fileContents))
return [System.Convert]::ToBase64String($hashBytes)
}