Merge pull request #7 from AndrewDemski-ad-gmail-com/AndrewDemski-ad-gmail-com-patch-3

Update Test-Network.ps1
pull/675/head
Andrzej Demski 2024-09-01 11:49:00 +02:00 committed by GitHub
commit e23829ab79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 11 deletions

View File

@ -7,18 +7,19 @@ function Test-Network {
#Test connectivity during 30 min then timeout
Write-ToLog "Checking internet connection..." "Yellow"
try {
$NlaRegKey = "HKLM:\SYSTEM\CurrentControlSet\Services\NlaSvc\Parameters\Internet"
$ncsiHost = Get-ItemPropertyValue -Path $NlaRegKey -Name ActiveWebProbeHost
$ncsiPath = Get-ItemPropertyValue -Path $NlaRegKey -Name ActiveWebProbePath
$ncsiContent = Get-ItemPropertyValue -Path $NlaRegKey -Name ActiveWebProbeContent
} catch {
$ncsiHost = "www.msftconnecttest.com"
$ncsiPath = "connecttest.txt"
$ncsiContent = "Microsoft Connect Test"
}
While ($timeout -lt 1800) {
try {
$ncsiHost = Get-ItemPropertyValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\NlaSvc\Parameters\Internet" -Name ActiveWebProbeHost
$ncsiPath = Get-ItemPropertyValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\NlaSvc\Parameters\Internet" -Name ActiveWebProbePath
$ncsiContent = Get-ItemPropertyValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\NlaSvc\Parameters\Internet" -Name ActiveWebProbeContent
} catch {
$ncsiHost = "www.msftconnecttest.com"
$ncsiPath = "connecttest.txt"
$ncsiContent = "Microsoft Connect Test"
}
try {
$ncsiResponse = Invoke-WebRequest -Uri "http://$($ncsiHost)/$($ncsiPath)" -UseBasicParsing -UserAgent ([Microsoft.PowerShell.Commands.PSUserAgent]::Chrome)
} catch {