Skip to content

Commit

Permalink
initialize status code instead of trying to grab it from exception
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-no committed Apr 15, 2024
1 parent 58a9c92 commit 89f8b3d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Powershell/InstallHuntress.powershellv2.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,7 @@ function testNetworkConnectivity {
"https://update.huntress.io/agent/connectivity/96bca0cef10f45a8f7cf68c4485f23a4.txt")

foreach ($URL in $URLs) {
$StatusCode = 0
try
{
$Response = Invoke-WebRequest -Uri $URL -TimeoutSec 5 -ErrorAction Stop -ContentType "text/plain"
Expand All @@ -789,7 +790,6 @@ function testNetworkConnectivity {
$ContentMatch = $StrContent -eq "96bca0cef10f45a8f7cf68c4485f23a4"
} catch {
Write-Output "Error: $($_.Exception.Message)"
$StatusCode = $_.exception.response.statuscode.value__
}

if ($StatusCode -ne 200) {
Expand Down

0 comments on commit 89f8b3d

Please sign in to comment.