From c3a04a1d9a909e05969c437f68ba934388215686 Mon Sep 17 00:00:00 2001 From: Suruchi Maini <134455898+MainiSuruchi@users.noreply.github.com> Date: Thu, 13 Jun 2024 11:33:26 -0700 Subject: [PATCH] New Windows Checks for WinHttpAutoProxySvc and iphlpsvc Services (#221) * NEw Windows Checks for WinHttpAutoProxySvc and iphlpsvc Services * created 2 seperate checks for each services * updated with minor changes * changes made in the windows services * changed the names of the checks. --- AzFilesHybrid/AzFilesHybrid.psm1 | 63 +++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/AzFilesHybrid/AzFilesHybrid.psm1 b/AzFilesHybrid/AzFilesHybrid.psm1 index 1800a53..7b33a66 100644 --- a/AzFilesHybrid/AzFilesHybrid.psm1 +++ b/AzFilesHybrid/AzFilesHybrid.psm1 @@ -3839,7 +3839,9 @@ function Debug-AzStorageAccountEntraKerbAuth { "CheckEntraObject" = [CheckResult]::new("CheckEntraObject"); "CheckRegKey" = [CheckResult]::new("CheckRegKey"); "CheckKerbRealmMapping" = [CheckResult]::new("CheckKerbRealmMapping"); - "CheckAdminConsent" = [CheckResult]::new("CheckAdminConsent") + "CheckAdminConsent" = [CheckResult]::new("CheckAdminConsent"); + "CheckWinHttpAutoProxySvc" = [CheckResult]::new("CheckWinHttpAutoProxySvc"); + "CheckIpHlpScv" = [CheckResult]::new("CheckIpHlpScv") } # # Port 445 check @@ -4061,6 +4063,65 @@ function Debug-AzStorageAccountEntraKerbAuth { Debug-EntraKerbAdminConsent -StorageAccountName $StorageAccountName -checkResult $checks["CheckAdminConsent"] } + # + # Check if WinHttpAutoProxySvc service is running + # + if (!$filterIsPresent -or $Filter -match "CheckWinHttpAutoProxySvc") + { + try + { + $checksExecuted += 1; + $service = Get-Service WinHttpAutoProxySvc + if (($service -eq $null) -or ($service.Status -ne "Running")) + { + $checks["CheckWinHttpAutoProxySvc"].Result = "Failed" + Write-Error "CheckWinHttpAutoProxySvc - FAILED" + } + else { + $checks["CheckWinHttpAutoProxySvc"].Result = "Passed" + Write-Verbose "CheckWinHttpAutoProxySvc - SUCCESS" + } + } + catch + { + $checks["CheckWinHttpAutoProxySvc"].Result = "Failed" + $checks["CheckWinHttpAutoProxySvc"].Issue = $_ + Write-Error "CheckWinHttpAutoProxySvc - FAILED" + Write-Error $_ + } + + } + # + #Check if iphlpsvc service is running + # + if (!$filterIsPresent -or $Filter -match "CheckIpHlpScv") + { + try + { + $checksExecuted += 1; + $services = Get-Service iphlpsvc + if (($services -eq $null) -or ($services.Status -ne "Running")) + { + $checks["CheckIpHlpScv"].Result = "Failed" + Write-Error "CheckIpHlpScv - FAILED" + Write-Error "These services need to be in running state." + } + else + { + $checks["CheckIpHlpScv"].Result = "Passed" + Write-Verbose "CheckIpHlpScv - SUCCESS" + } + } + catch + { + $checks["CheckIpHlpScv"].Result = "Failed" + $checks["CheckIpHlpScv"].Issue = $_ + Write-Error "CheckIpHlpScv - FAILED" + Write-Error $_ + } + + } + SummaryOfChecks -filterIsPresent $filterIsPresent -checksExecuted $checksExecuted } }