From ac41f6fe482f365d12f79eec9b43772053a26d0b Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Sat, 20 Jun 2020 07:33:48 -0600 Subject: [PATCH] move get-content into try, silence errors --- sri.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sri.ps1 b/sri.ps1 index ce31c1a..58cf337 100644 --- a/sri.ps1 +++ b/sri.ps1 @@ -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) }