move get-content into try, silence errors
This commit is contained in:
parent
8a04d654ef
commit
ac41f6fe48
3
sri.ps1
3
sri.ps1
@ -45,9 +45,8 @@ function hashSHA($type){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function doHash($file, $hash){
|
function doHash($file, $hash){
|
||||||
$fileContents = Get-Content $file -Raw
|
|
||||||
$fileContents = Get-Content $file -Raw -ErrorAction SilentlyContinue
|
|
||||||
try {
|
try {
|
||||||
|
$fileContents = Get-Content $file -Raw -ErrorAction SilentlyContinue
|
||||||
$hashBytes = $hash.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($fileContents))
|
$hashBytes = $hash.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($fileContents))
|
||||||
return [System.Convert]::ToBase64String($hashBytes)
|
return [System.Convert]::ToBase64String($hashBytes)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user